79 int start_partition, end_packet;
80 int extended_bits, part_id;
81 int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,
83 int pictureid = -1, pictureid_mask = 0;
84 int returned_old_frame = 0;
85 uint32_t old_timestamp = 0;
103 extended_bits = buf[0] & 0x80;
104 start_partition = buf[0] & 0x10;
105 part_id = buf[0] & 0x0f;
112 pictureid_present = buf[0] & 0x80;
113 tl0picidx_present = buf[0] & 0x40;
114 tid_present = buf[0] & 0x20;
115 keyidx_present = buf[0] & 0x10;
119 if (pictureid_present) {
125 pictureid =
AV_RB16(buf) & 0x7fff;
126 pictureid_mask = 0x7fff;
130 pictureid = buf[0] & 0x7f;
131 pictureid_mask = 0x7f;
136 if (tl0picidx_present) {
141 if (tid_present || keyidx_present) {
149 if (start_partition && part_id == 0 && len >= 3) {
151 int non_key = buf[0] & 0x01;
165 if (pictureid >= 0) {
168 "Missed a picture, sequence broken\n");
170 if (vp8->
data && !can_continue)
172 "Missed a picture, sequence broken\n");
175 uint16_t expected_seq = vp8->
prev_seq + 1;
176 int16_t diff = seq - expected_seq;
185 if ((diff == 0 || diff == 1) && can_continue) {
189 "Missed too much, sequence broken\n");
194 "Missed unknown data, sequence broken\n");
204 returned_old_frame = 1;
220 uint16_t expected_seq = vp8->
prev_seq + 1;
228 "Received no start marker; dropping frame\n");
231 if (seq != expected_seq) {
234 "Missed part of a keyframe, sequence broken\n");
240 "Missed part of the first partition, sequence broken\n");
252 if (returned_old_frame) {
253 *timestamp = old_timestamp;
254 return end_packet ? 1 : 0;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
#define AV_LOG_WARNING
Something somehow does not look correct.
RTP/JPEG specific private data.
int index
stream index in AVFormatContext
static void vp8_free_buffer(PayloadContext *vp8)
RTPDynamicProtocolHandler ff_vp8_dynamic_handler
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
uint32_t timestamp
current frame timestamp
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
void av_log(void *avcl, int level, const char *fmt,...)
static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
int flags
A combination of AV_PKT_FLAG values.
static void vp8_free_context(PayloadContext *vp8)
static int vp8_need_keyframe(PayloadContext *vp8)
static PayloadContext * vp8_new_context(void)
static int vp8_broken_sequence(AVFormatContext *ctx, PayloadContext *vp8, const char *msg)
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx)
Close the dynamic buffer and make a packet from it.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...