summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-09-12 13:56:31 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-09-12 13:57:41 +0200
commit677eaa6692d73c1d5b51cde20e0176a937467c8b (patch)
tree202f4c188391032230e2dd864de529caa40f3a14
parent5c1ab55c5ca0019fd567480b9c216c1048e56bff (diff)
avviddec: Initialize strides with the ones of avcodec_default_get_buffer() if we ever call it
https://bugzilla.gnome.org/show_bug.cgi?id=704769
-rw-r--r--ext/libav/gstavviddec.c16
-rw-r--r--ext/libav/gstavviddec.h2
2 files changed, 14 insertions, 4 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 5995d03..3e537a0 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -617,6 +617,10 @@ gst_ffmpegviddec_get_buffer (AVCodecContext * context, AVFrame * picture)
if (ffmpegdec->stride[c] == -1) {
ffmpegdec->stride[c] = picture->linesize[c];
} else if (picture->linesize[c] != ffmpegdec->stride[c]) {
+ GST_LOG_OBJECT (ffmpegdec,
+ "No direct rendering, stride changed c=%d %d->%d", c,
+ ffmpegdec->stride[c], picture->linesize[c]);
+
for (c = 0; c < AV_NUM_DATA_POINTERS; c++) {
picture->data[c] = NULL;
picture->linesize[c] = 0;
@@ -671,7 +675,13 @@ invalid_frame:
}
fallback:
{
- return avcodec_default_get_buffer (context, picture);
+ int c;
+ int ret = avcodec_default_get_buffer (context, picture);
+
+ for (c = 0; c < AV_NUM_DATA_POINTERS; c++)
+ ffmpegdec->stride[c] = picture->linesize[c];
+
+ return ret;
}
duplicate_frame:
{
@@ -1570,8 +1580,8 @@ gst_ffmpegviddec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
avcodec_align_dimensions2 (ffmpegdec->context, &width, &height,
linesize_align);
edge =
- ffmpegdec->
- context->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width ();
+ ffmpegdec->context->
+ flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width ();
/* increase the size for the padding */
width += edge << 1;
height += edge << 1;
diff --git a/ext/libav/gstavviddec.h b/ext/libav/gstavviddec.h
index 5fadcd8..cd691ec 100644
--- a/ext/libav/gstavviddec.h
+++ b/ext/libav/gstavviddec.h
@@ -37,7 +37,7 @@ struct _GstFFMpegVidDec
/* decoding */
AVCodecContext *context;
AVFrame *picture;
- gint stride[4];
+ gint stride[AV_NUM_DATA_POINTERS];
gboolean opened;
/* current context */