aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-01-09 14:25:59 +0200
committerMartin Storsjö <martin@martin.st>2013-01-10 09:43:01 +0200
commit76c40fbef06aaf5013450a4b51dd3c49955777a1 (patch)
treef9fbb8b8f7c0b63f620e1f3eb84504dc9a2b0ff8
parent3b366c3aa0800d2df9f0678f6f4d7791b8adf2a9 (diff)
downloadffmpeg-76c40fbef06aaf5013450a4b51dd3c49955777a1.tar.gz
rtpdec_vp8: Don't trim too much data from broken frames
Previously, for broken frames, we only returned the first partition of the frame (we would append all the received packets to the packet buffer, then set pkt->size to the size of the first partition, since the rest of the frame could have lost data inbetween) - now instead return the full buffered data we have, but don't append anything more to the buffer after the lost packet discontinuity. Decoding the truncated packet should hopefully get better quality than trimming out everything after the first partition. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/rtpdec_vp8.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c
index b7d5345ab7..3db61c143e 100644
--- a/libavformat/rtpdec_vp8.c
+++ b/libavformat/rtpdec_vp8.c
@@ -200,7 +200,6 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
if (ret < 0)
return ret;
- pkt->size = vp8->first_part_size;
pkt->flags |= AV_PKT_FLAG_CORRUPT;
returned_old_frame = 1;
old_timestamp = vp8->timestamp;
@@ -247,7 +246,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");
vp8->prev_seq = seq;
- avio_write(vp8->data, buf, len);
+ if (!vp8->broken_frame)
+ avio_write(vp8->data, buf, len);
if (returned_old_frame) {
*timestamp = old_timestamp;
@@ -259,8 +259,6 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
if (ret < 0)
return ret;
- if (vp8->broken_frame)
- pkt->size = vp8->first_part_size;
if (vp8->sequence_dirty)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
return 0;