summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2015-08-03 21:40:12 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2015-08-03 21:40:12 -0400
commit1c70fb229a0f6f9637040acf59f23ce629b5e07a (patch)
tree885ba31cf67276fa0e90cbf233ad8bfbe25a3e95
parente7ece560d6213f152ac553a81d4ac36439259027 (diff)
downloadgst-libav-1c70fb229a0f6f9637040acf59f23ce629b5e07a.tar.gz
avviddec: Use caps-like size in get_buffer2()
The size in the AVFrame in get_buffer2 don't match the output size, instead they match ffmpeg's memory requirements, so we can't compare them from the values of the output AVFrame. Those are comparable to the values in the passed AVCodecContext.
-rw-r--r--ext/libav/gstavviddec.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 03a7334..51de756 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -660,20 +660,16 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, AVFrame * picture,
/* If the picture format changed but we already negotiated before,
* we will have to do fallback allocation until output and input
* formats are in sync again. We will renegotiate on the output
+ * We use the info from the context which correspond to the input format,
+ * the info from the picture correspond to memory requires, not to the actual
+ * image size.
*/
- if (ffmpegdec->pic_width != 0 && picture_changed (ffmpegdec, picture))
+ if (ffmpegdec->pic_width != 0 &&
+ !(ffmpegdec->pic_width == context->width
+ && ffmpegdec->pic_height == context->height
+ && ffmpegdec->pic_pix_fmt == picture->format))
goto fallback;
- /* see if we need renegotiation */
- /* Disabled for now as ffmpeg doesn't give us the output dimensions
- * in the getbuffer2 callback. The real dimensions are only available
- * when a buffer is produced.
- */
- if (FALSE
- && G_UNLIKELY (!gst_ffmpegviddec_negotiate (ffmpegdec, context, picture,
- FALSE)))
- goto negotiate_failed;
-
if (!ffmpegdec->current_dr)
goto no_dr;
@@ -745,11 +741,6 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, AVFrame * picture,
return 0;
/* fallbacks */
-negotiate_failed:
- {
- GST_DEBUG_OBJECT (ffmpegdec, "negotiate failed");
- goto fallback;
- }
no_dr:
{
GST_LOG_OBJECT (ffmpegdec, "direct rendering disabled, fallback alloc");