mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
rtpdec: Pass the sequence number to depacketizers
This allows depacketizers to figure out if packets have been lost. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
0a0e340f5b
commit
90c784cc13
@ -293,7 +293,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
|
|||||||
static int
|
static int
|
||||||
rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
|
rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
|
||||||
AVPacket *pkt, uint32_t *timestamp,
|
AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t rtp_seq, int flags)
|
||||||
{
|
{
|
||||||
int seq = 1, res;
|
int seq = 1, res;
|
||||||
AVIOContext pb;
|
AVIOContext pb;
|
||||||
@ -348,7 +348,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
|
|||||||
timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
|
timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
|
||||||
rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
|
rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
|
||||||
s->streams[s->prev_stream_id],
|
s->streams[s->prev_stream_id],
|
||||||
pkt, ×tamp, NULL, 0, flags);
|
pkt, ×tamp, NULL, 0, 0, flags);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
|
|||||||
|
|
||||||
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
||||||
s->streams[s->prev_stream_id],
|
s->streams[s->prev_stream_id],
|
||||||
pkt, ×tamp, buf, len, flags);
|
pkt, ×tamp, buf, len, 0, flags);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (s->parse_packet) {
|
} else if (s->parse_packet) {
|
||||||
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
||||||
s->st, pkt, ×tamp, buf, len, flags);
|
s->st, pkt, ×tamp, buf, len, seq, flags);
|
||||||
} else {
|
} else {
|
||||||
/* At this point, the RTP header has been stripped;
|
/* At this point, the RTP header has been stripped;
|
||||||
* This is ASSUMING that there is only 1 CSRC, which isn't wise. */
|
* This is ASSUMING that there is only 1 CSRC, which isn't wise. */
|
||||||
@ -682,7 +682,8 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
|
|||||||
* the packet is left with pts == AV_NOPTS_VALUE */
|
* the packet is left with pts == AV_NOPTS_VALUE */
|
||||||
timestamp = RTP_NOTS_VALUE;
|
timestamp = RTP_NOTS_VALUE;
|
||||||
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
|
||||||
s->st, pkt, ×tamp, NULL, 0, flags);
|
s->st, pkt, ×tamp, NULL, 0, 0,
|
||||||
|
flags);
|
||||||
finalize_packet(s, pkt, timestamp);
|
finalize_packet(s, pkt, timestamp);
|
||||||
return rv;
|
return rv;
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,6 +101,7 @@ typedef struct RTPStatistics {
|
|||||||
* updated by the function if returning older, buffered data
|
* updated by the function if returning older, buffered data
|
||||||
* @param buf pointer to raw RTP packet data
|
* @param buf pointer to raw RTP packet data
|
||||||
* @param len length of buf
|
* @param len length of buf
|
||||||
|
* @param seq RTP sequence number of the packet
|
||||||
* @param flags flags from the RTP packet header (RTP_FLAG_*)
|
* @param flags flags from the RTP packet header (RTP_FLAG_*)
|
||||||
*/
|
*/
|
||||||
typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx,
|
typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx,
|
||||||
@ -108,7 +109,7 @@ typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx,
|
|||||||
AVStream *st, AVPacket *pkt,
|
AVStream *st, AVPacket *pkt,
|
||||||
uint32_t *timestamp,
|
uint32_t *timestamp,
|
||||||
const uint8_t * buf,
|
const uint8_t * buf,
|
||||||
int len, int flags);
|
int len, uint16_t seq, int flags);
|
||||||
|
|
||||||
struct RTPDynamicProtocolHandler {
|
struct RTPDynamicProtocolHandler {
|
||||||
const char enc_name[50];
|
const char enc_name[50];
|
||||||
|
@ -51,13 +51,10 @@ static void amr_free_context(PayloadContext *data)
|
|||||||
av_free(data);
|
av_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int amr_handle_packet(AVFormatContext *ctx,
|
static int amr_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
PayloadContext *data,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
AVStream *st,
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
AVPacket * pkt,
|
int flags)
|
||||||
uint32_t * timestamp,
|
|
||||||
const uint8_t * buf,
|
|
||||||
int len, int flags)
|
|
||||||
{
|
{
|
||||||
const uint8_t *frame_sizes = NULL;
|
const uint8_t *frame_sizes = NULL;
|
||||||
int frames;
|
int frames;
|
||||||
|
@ -168,7 +168,8 @@ struct PayloadContext {
|
|||||||
static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
|
||||||
AVStream *st, AVPacket *pkt,
|
AVStream *st, AVPacket *pkt,
|
||||||
uint32_t *timestamp,
|
uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
AVIOContext *pb = &asf->pb;
|
AVIOContext *pb = &asf->pb;
|
||||||
int res, mflags, len_off;
|
int res, mflags, len_off;
|
||||||
|
@ -33,7 +33,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
|
|||||||
|
|
||||||
int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags);
|
const uint8_t *buf, int len, uint16_t seq, int flags);
|
||||||
|
|
||||||
extern RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler;
|
extern RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler;
|
||||||
extern RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler;
|
extern RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq, int flags)
|
||||||
{
|
{
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
uint16_t header;
|
uint16_t header;
|
||||||
|
@ -57,7 +57,8 @@ static void h263_free_context(PayloadContext *data)
|
|||||||
|
|
||||||
static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
/* Corresponding to header fields in the RFC */
|
/* Corresponding to header fields in the RFC */
|
||||||
int f, p, i, sbit, ebit, src, r;
|
int f, p, i, sbit, ebit, src, r;
|
||||||
@ -65,7 +66,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
|||||||
|
|
||||||
if (data->newformat)
|
if (data->newformat)
|
||||||
return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, len,
|
return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, len,
|
||||||
flags);
|
seq, flags);
|
||||||
|
|
||||||
if (data->buf && data->timestamp != *timestamp) {
|
if (data->buf && data->timestamp != *timestamp) {
|
||||||
/* Dropping old buffered, unfinished data */
|
/* Dropping old buffered, unfinished data */
|
||||||
@ -122,7 +123,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
|||||||
"signalled with a static payload type.\n");
|
"signalled with a static payload type.\n");
|
||||||
data->newformat = 1;
|
data->newformat = 1;
|
||||||
return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf,
|
return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf,
|
||||||
len, flags);
|
len, seq, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,8 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
|
|||||||
// return 0 on packet, no more left, 1 on packet, 1 on partial packet
|
// return 0 on packet, no more left, 1 on packet, 1 on partial packet
|
||||||
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
uint8_t nal;
|
uint8_t nal;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
@ -219,7 +219,8 @@ static void create_default_qtables(uint8_t *qtables, uint8_t q)
|
|||||||
|
|
||||||
static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
|
static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
uint8_t type, q, width, height;
|
uint8_t type, q, width, height;
|
||||||
const uint8_t *qtables = NULL;
|
const uint8_t *qtables = NULL;
|
||||||
|
@ -51,7 +51,8 @@ static void latm_free_context(PayloadContext *data)
|
|||||||
|
|
||||||
static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
int ret, cur_len;
|
int ret, cur_len;
|
||||||
|
|
||||||
|
@ -159,7 +159,8 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf)
|
|||||||
/* Follows RFC 3640 */
|
/* Follows RFC 3640 */
|
||||||
static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
if (rtp_parse_mp4_au(data, buf))
|
if (rtp_parse_mp4_au(data, buf))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -210,7 +210,8 @@ static int return_stored_frame(AVFormatContext *ctx, PayloadContext *data,
|
|||||||
|
|
||||||
static int qcelp_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
static int qcelp_parse_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
if (buf)
|
if (buf)
|
||||||
return store_packet(ctx, data, st, pkt, timestamp, buf, len);
|
return store_packet(ctx, data, st, pkt, timestamp, buf, len);
|
||||||
|
@ -237,7 +237,8 @@ static int qdm2_restore_block(PayloadContext *qdm, AVStream *st, AVPacket *pkt)
|
|||||||
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
|
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
|
||||||
AVStream *st, AVPacket *pkt,
|
AVStream *st, AVPacket *pkt,
|
||||||
uint32_t *timestamp,
|
uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
int res = AVERROR_INVALIDDATA, n;
|
int res = AVERROR_INVALIDDATA, n;
|
||||||
const uint8_t *end = buf + len, *p = buf;
|
const uint8_t *end = buf + len, *p = buf;
|
||||||
|
@ -42,7 +42,7 @@ struct PayloadContext {
|
|||||||
static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
|
||||||
AVStream *st, AVPacket *pkt,
|
AVStream *st, AVPacket *pkt,
|
||||||
uint32_t *timestamp, const uint8_t *buf,
|
uint32_t *timestamp, const uint8_t *buf,
|
||||||
int len, int flags)
|
int len, uint16_t seq, int flags)
|
||||||
{
|
{
|
||||||
AVIOContext pb;
|
AVIOContext pb;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
|
@ -41,7 +41,8 @@ struct PayloadContext {
|
|||||||
static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
|
static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
|
||||||
AVStream *st, AVPacket *pkt,
|
AVStream *st, AVPacket *pkt,
|
||||||
uint32_t *timestamp,
|
uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
int config_packet, start_packet, end_packet;
|
int config_packet, start_packet, end_packet;
|
||||||
|
|
||||||
|
@ -36,13 +36,10 @@ struct PayloadContext {
|
|||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vp8_handle_packet(AVFormatContext *ctx,
|
static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
|
||||||
PayloadContext *vp8,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
AVStream *st,
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
AVPacket *pkt,
|
int flags)
|
||||||
uint32_t *timestamp,
|
|
||||||
const uint8_t *buf,
|
|
||||||
int len, int flags)
|
|
||||||
{
|
{
|
||||||
int start_partition, end_packet;
|
int start_partition, end_packet;
|
||||||
int extended_bits, part_id;
|
int extended_bits, part_id;
|
||||||
|
@ -70,12 +70,10 @@ static void xiph_free_context(PayloadContext * data)
|
|||||||
av_free(data);
|
av_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xiph_handle_packet(AVFormatContext * ctx,
|
static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||||
PayloadContext * data,
|
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
|
||||||
AVStream * st,
|
const uint8_t *buf, int len, uint16_t seq,
|
||||||
AVPacket * pkt,
|
int flags)
|
||||||
uint32_t * timestamp,
|
|
||||||
const uint8_t * buf, int len, int flags)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int ident, fragmented, tdt, num_pkts, pkt_len;
|
int ident, fragmented, tdt, num_pkts, pkt_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user