From 09ed8098ff66b2a606cdb6b92a97ca00d0ca04eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 7 Jan 2013 21:42:46 +0200 Subject: [PATCH 1/2] rtpdec_vp8: Make sure the previous packet is returned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a bug from c7d4de3d73 - if the previous frame wasn't returned yet (due to missing the final packets), but we have enough data of it to return the first partition, we write that into pkt and set returned_old_frame. That commit forgot returning 0 for the case where this current packet didn't have the end_packet flag set. Signed-off-by: Martin Storsjö --- libavformat/rtpdec_vp8.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index 6dbf402df6..966f7b8734 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -233,12 +233,13 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, vp8->prev_seq = seq; avio_write(vp8->data, buf, len); + if (returned_old_frame) { + *timestamp = old_timestamp; + return end_packet ? 1 : 0; + } + if (end_packet) { int ret; - if (returned_old_frame) { - *timestamp = old_timestamp; - return 1; - } ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index); if (ret < 0) return ret; From 9c80ed836a511293f4cc3a858060969d32f2b1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 7 Jan 2013 22:02:07 +0200 Subject: [PATCH 2/2] rtpdec_vp8: Avoid a warning about a possibly unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning is a false positive, but I prefer actually initializing it over masking it with av_uninit, since the code is not performance critical. Signed-off-by: Martin Storsjö --- libavformat/rtpdec_vp8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index 966f7b8734..13efa54421 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -70,7 +70,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, int extended_bits, part_id; int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0, keyidx_present = 0; - int pictureid = -1, pictureid_mask; + int pictureid = -1, pictureid_mask = 0; int returned_old_frame = 0; uint32_t old_timestamp;