From 5d876be87a115b93dd2e644049e3ada2cfb5ccb7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 24 Jun 2013 14:23:44 +0200 Subject: [PATCH 1/5] avio: Handle AVERROR_EOF in the same way as the return value 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure the ffurl_read_complete function actually returns the number of bytes read, as the documentation of the function says, even if the underlying protocol uses AVERROR_EOF instead of 0. Signed-off-by: Martin Storsjö --- libavformat/avio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index a43b241399..ad39e6fdb0 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -238,7 +238,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int else av_usleep(1000); } else if (ret < 1) - return ret < 0 ? ret : len; + return (ret < 0 && ret != AVERROR_EOF) ? ret : len; if (ret) fast_retries = FFMAX(fast_retries, 2); len += ret; From d35b6cd3775456a23b63e73316e244b671caa02f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 1 Jul 2013 23:38:08 +0200 Subject: [PATCH 2/5] rmdec: Use the AVIOContext given as parameter in rm_read_metadata() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes crashes when playing back certain RealRTSP streams. When invoked from the RTP depacketizer, the full realmedia demuxer isn't invoked, but only certain functions from it, where a separate AVIOContext is passed in as parameter (for the buffer containing the data to parse). The functions called from within those entry points should only be using that parameter, not s->pb. In the depacketizer case, s is the RTSP context, where ->pb is null. Cc: libav-stable@libav.org Signed-off-by: Martin Storsjö --- libavformat/rmdec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 3dafa395f5..1750db8bfa 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -93,13 +93,13 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si return 0; } -static void rm_read_metadata(AVFormatContext *s, int wide) +static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) { char buf[1024]; int i; for (i=0; ipb) : avio_r8(s->pb); - get_strl(s->pb, buf, sizeof(buf), len); + int len = wide ? avio_rb16(pb) : avio_r8(pb); + get_strl(pb, buf, sizeof(buf), len); av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); } } @@ -129,7 +129,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int header_size = avio_rb16(pb); int64_t startpos = avio_tell(pb); avio_skip(pb, 14); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") avio_r8(pb); @@ -276,7 +276,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, avio_r8(pb); avio_r8(pb); avio_r8(pb); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); } } return 0; @@ -468,7 +468,7 @@ static int rm_read_header(AVFormatContext *s) flags = avio_rb16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): - rm_read_metadata(s, 1); + rm_read_metadata(s, pb, 1); break; case MKTAG('M', 'D', 'P', 'R'): st = avformat_new_stream(s, NULL); From 6c86a63bad7700848b1e46337038cf5bd06abbe6 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 24 Jun 2013 19:13:58 -0400 Subject: [PATCH 3/5] yuv4mpeg: Correctly round chroma up for odd luma sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/yuv4mpeg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 699a63a681..c38d641e06 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -132,8 +132,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) // Adjust for smaller Cb and Cr planes av_pix_fmt_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift, &v_chroma_shift); - width >>= h_chroma_shift; - height >>= v_chroma_shift; + // Shift right, rounding up + width = -(-width >> h_chroma_shift); + height = -(-height >> v_chroma_shift); ptr1 = picture->data[1]; ptr2 = picture->data[2]; From 46d208e1e097ab0bb37aea8f3ffa80a25b4d0eef Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 22 Jun 2013 21:16:11 -0700 Subject: [PATCH 4/5] vp8: Wait for prev_frame to parse segment_map before reading it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes occasional failures of vp8-test-vector-010 with frame-level multithreading enabled. Signed-off-by: Martin Storsjö --- libavcodec/vp8.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 068764827b..17b79f5fc4 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1679,6 +1679,11 @@ static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, if (s->mb_layout == 1) mb = s->macroblocks_base + ((s->mb_width+1)*(mb_y + 1) + 1); else { + // Make sure the previous frame has read its segmentation map, + // if we re-use the same map. + if (prev_frame && s->segmentation.enabled && + !s->segmentation.update_map) + ff_thread_await_progress(&prev_frame->tf, mb_y, 0); mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; memset(mb - 1, 0, sizeof(*mb)); // zero left macroblock AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); @@ -1960,13 +1965,14 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, memset(s->ref_count, 0, sizeof(s->ref_count)); - // Make sure the previous frame has read its segmentation map, - // if we re-use the same map. - if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) - ff_thread_await_progress(&prev_frame->tf, 1, 0); - - if (s->mb_layout == 1) + if (s->mb_layout == 1) { + // Make sure the previous frame has read its segmentation map, + // if we re-use the same map. + if (prev_frame && s->segmentation.enabled && + !s->segmentation.update_map) + ff_thread_await_progress(&prev_frame->tf, 1, 0); vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); + } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; From 38e9585de993c32899588ab037180f2c930ce74c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 7 Jul 2013 11:56:02 +0200 Subject: [PATCH 5/5] Makefile: Remove stray tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 9d002a8e7f..35070d7afb 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -9,7 +9,7 @@ OBJS = allformats.o \ avio.o \ aviobuf.o \ cutils.o \ - format.o \ + format.o \ id3v1.o \ id3v2.o \ log2_tab.o \