[vlc-commits] avcodec:video: log the reason why the format change won't reuse the decoder
Steve Lhomme
git at videolan.org
Tue Aug 7 09:13:10 CEST 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jul 30 13:59:36 2018 +0200| [47755e9fa436af9b5d326fd7db96c0cc4b6591d5] | committer: Steve Lhomme
avcodec:video: log the reason why the format change won't reuse the decoder
Ref: #20343
(cherry picked from commit 923dcb3cda8fa679ebb14809a3e9b7c6d8a40054)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=47755e9fa436af9b5d326fd7db96c0cc4b6591d5
---
modules/codec/avcodec/video.c | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c18d4a58eb..664d045c58 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1524,25 +1524,40 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
can_hwaccel = true;
}
+ if (p_sys->pix_fmt == AV_PIX_FMT_NONE)
+ goto no_reuse;
+
/* If the format did not actually change (e.g. seeking), try to reuse the
* existing output format, and if present, hardware acceleration back-end.
* This avoids resetting the pipeline downstream. This also avoids
* needlessly probing for hardware acceleration support. */
- if (p_sys->pix_fmt != AV_PIX_FMT_NONE
- && lavc_GetVideoFormat(p_dec, &fmt, p_context, p_sys->pix_fmt, swfmt) == 0
- && fmt.i_width == p_dec->fmt_out.video.i_width
- && fmt.i_height == p_dec->fmt_out.video.i_height
- && p_context->profile == p_sys->profile
- && p_context->level <= p_sys->level)
- {
- for (size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++)
- if (pi_fmt[i] == p_sys->pix_fmt)
- {
- msg_Dbg(p_dec, "reusing decoder output format %d", pi_fmt[i]);
- return p_sys->pix_fmt;
- }
- }
+ if (lavc_GetVideoFormat(p_dec, &fmt, p_context, p_sys->pix_fmt, swfmt) != 0)
+ {
+ msg_Dbg(p_dec, "get format failed");
+ goto no_reuse;
+ }
+ if (fmt.i_width != p_dec->fmt_out.video.i_width ||
+ fmt.i_height != p_dec->fmt_out.video.i_height)
+ {
+ msg_Dbg(p_dec, "mismatched dimensions %ux%u was %ux%u", fmt.i_width, fmt.i_height,
+ p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height);
+ goto no_reuse;
+ }
+ if (p_context->profile != p_sys->profile || p_context->level > p_sys->level)
+ {
+ msg_Dbg(p_dec, "mismatched profile level %d/%d was %d/%d", p_context->profile,
+ p_context->level, p_sys->profile, p_sys->level);
+ goto no_reuse;
+ }
+
+ for (size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++)
+ if (pi_fmt[i] == p_sys->pix_fmt)
+ {
+ msg_Dbg(p_dec, "reusing decoder output format %d", pi_fmt[i]);
+ return p_sys->pix_fmt;
+ }
+no_reuse:
if (p_sys->p_va != NULL)
{
msg_Err(p_dec, "existing hardware acceleration cannot be reused");
More information about the vlc-commits
mailing list