summaryrefslogtreecommitdiff
path: root/src/liana/common.h
blob: bdf4704d7da227e3a937ce6d7a459e9b3ca740cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <nnwt/packet.h>

#include "../server/common.h"
#include "../codec/codec.h"

#define LIANA_TIMESTAMP_INVALID ((u64)-1)

#define LIANA_BASE_DELAY ((u64)1600000) // 1600ms
#define LIANA_BASE_PING ((u64)600000) // 600ms
#define LIANA_PAUSE_DELAY LIANA_BASE_PING

static inline void disown_packet(struct nn_packet *packet)
{
#ifdef CAMU_DIRECT_MODE
    if (packet->opaque) {
        switch (nn_packet_get_u8(packet, NNWT_PACKET_HEADER_LENGTH + 5)) {
        case CAMU_NORMAL:
            break;
#ifdef CAMU_HAVE_FFMPEG
        case CAMU_FFMPEG_COMPAT: {
            AVPacket *pkt = (AVPacket *)packet->opaque;
            av_packet_free_side_data(pkt);
            av_packet_free(&pkt);
            break;
        }
#endif
        }
        packet->opaque = NULL;
    }
#else
    (void)packet;
#endif
}