70 int start_partition, end_packet;
71 int extended_bits, part_id;
72 int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,
74 int pictureid = -1, pictureid_mask = 0;
75 int returned_old_frame = 0;
76 uint32_t old_timestamp = 0;
94 extended_bits = buf[0] & 0x80;
95 start_partition = buf[0] & 0x10;
96 part_id = buf[0] & 0x0f;
103 pictureid_present = buf[0] & 0x80;
104 tl0picidx_present = buf[0] & 0x40;
105 tid_present = buf[0] & 0x20;
106 keyidx_present = buf[0] & 0x10;
110 if (pictureid_present) {
116 pictureid =
AV_RB16(buf) & 0x7fff;
117 pictureid_mask = 0x7fff;
121 pictureid = buf[0] & 0x7f;
122 pictureid_mask = 0x7f;
127 if (tl0picidx_present) {
132 if (tid_present || keyidx_present) {
140 if (start_partition && part_id == 0 && len >= 3) {
142 int non_key = buf[0] & 0x01;
156 if (pictureid >= 0) {
159 "Missed a picture, sequence broken\n");
161 if (vp8->
data && !can_continue)
163 "Missed a picture, sequence broken\n");
166 uint16_t expected_seq = vp8->
prev_seq + 1;
167 int16_t
diff = seq - expected_seq;
176 if ((diff == 0 || diff == 1) && can_continue) {
180 "Missed too much, sequence broken\n");
185 "Missed unknown data, sequence broken\n");
195 returned_old_frame = 1;
211 uint16_t expected_seq = vp8->
prev_seq + 1;
219 "Received no start marker; dropping frame\n");
222 if (seq != expected_seq) {
225 "Missed part of a keyframe, sequence broken\n");
231 "Missed part of the first partition, sequence broken\n");
243 if (returned_old_frame) {
244 *timestamp = old_timestamp;
245 return end_packet ? 1 : 0;
static void vp8_close_context(PayloadContext *vp8)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
RTP/JPEG specific private data.
int index
stream index in AVFormatContext
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)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint32_t timestamp
current frame timestamp
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
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 int vp8_need_keyframe(PayloadContext *vp8)
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
uint8_t * buf
the temporary storage buffer
const RTPDynamicProtocolHandler ff_vp8_dynamic_handler
static int vp8_broken_sequence(AVFormatContext *ctx, PayloadContext *vp8, const char *msg)
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
#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.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
This structure stores compressed data.