[vlc-commits] avcodec: use decoder_GetPicture()
Rémi Denis-Courmont
git at videolan.org
Sun Sep 27 21:57:47 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 27 18:30:26 2015 +0300| [8133a0aae767df874bc6dccd5a0d26652b666fae] | committer: Rémi Denis-Courmont
avcodec: use decoder_GetPicture()
This reduces the semaphore contention scope.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8133a0aae767df874bc6dccd5a0d26652b666fae
---
modules/codec/avcodec/video.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 89b1cb3..a8bb7fa 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -766,7 +766,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
* then picture buffer can be allocated. */
if (p_sys->p_va == NULL
&& lavc_UpdateVideoFormat(p_dec, p_context, false) == 0)
- p_pic = decoder_NewPicture(p_dec);
+ p_pic = decoder_GetPicture(p_dec);
if( !p_pic )
{
@@ -1061,11 +1061,9 @@ static int lavc_GetFrame(struct AVCodecContext *ctx, AVFrame *frame, int flags)
return -1;
}
}
-
- /* FIXME: The core forces an extra output format update here, so the
- * semaphore is still needed. */
- pic = decoder_NewPicture(dec);
post_mt(sys);
+
+ pic = decoder_GetPicture(dec);
if (pic == NULL)
return -1;
@@ -1128,8 +1126,9 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
}
if (lavc_UpdateVideoFormat(p_dec, p_context, true))
continue; /* Unsupported brand of hardware acceleration */
+ post_mt(p_sys);
- picture_t *test_pic = decoder_NewPicture(p_dec);
+ picture_t *test_pic = decoder_GetPicture(p_dec);
assert(!test_pic || test_pic->format.i_chroma == p_dec->fmt_out.video.i_chroma);
vlc_va_t *va = vlc_va_New(VLC_OBJECT(p_dec), p_context, hwfmt,
&p_dec->fmt_in,
@@ -1137,8 +1136,10 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
if (test_pic)
picture_Release(test_pic);
if (va == NULL)
+ {
+ wait_mt(p_sys);
continue; /* Unsupported codec profile or such */
- post_mt(p_sys);
+ }
if (va->description != NULL)
msg_Info(p_dec, "Using %s for hardware decoding", va->description);
More information about the vlc-commits
mailing list