[FFmpeg-devel] [PATCH] lavc/cuvid: fail early if GPU can't handle video parameters

Philip Langdale philipl at overt.org
Sun Jan 22 20:13:10 EET 2017


On Sat, 21 Jan 2017 10:27:30 -0700
pkoshevoy at gmail.com wrote:

> From: Pavel Koshevoy <pkoshevoy at gmail.com>
> 
> Evidently CUVID doesn't support decoding 422 or 444 chroma formats,
> and only a limited set of resolutions per codec are supported.
> 
> Unfortunately CUVID silently drops packets for video of unsupported
> resolution.  However, it will error-out at cuvidCreateDecoder call
> if the indicated video resolution is not supported.
> 
> Given that stream resolution and pixel format are typically known as
> a result of probing it is better to use this information during
> avcodec_open2 call to fail immediately, rather than proceeding to
> decode and never receiving any frames from the decoder nor receiving
> any indication of decode failure.

So I'm confused. I agree that these errors do not emerge early enough
to induce failure at decoder init time, but they should all trigger
errors at first-frame decode time. That's certainly true for the
chroma format error, because I added that logic.

Assuming that is true, you should just be dealing with first-frame
failure and then falling back to SW decoding, or whatever policy
you want in your app (I assume 8K SW decoding won't go well...).

Sure, it's not great that you can't get failures at init time, but
you have to be prepared to encounter fatal errors on frame decode
with dealing with hardware decoders. Most, if not all, have failure
cases that only emerge when decoding a real frame.

There's a useful discussion to have about clearly indicating how
fatal an error is from that frame decode failure (so we know that
it's due to unsupported characteristics rather than a single bad
frame), but this change won't help us get there.

And I'll repeat wm4's warning that these tests depend on the presence
of probed data that cannot be assumed in the general case; it may work
for your app, but other applications may not fill in those fields, so
it cannot be considered reliable functionality.

Thanks,

--phil


More information about the ffmpeg-devel mailing list