[FFmpeg-devel] [PATCHv3 4/4] libavcodec: v4l2: add support for v4l2 mem2mem codecs

Mark Thompson sw at jkqxz.net
Tue Aug 8 01:01:07 EEST 2017

On 07/08/17 19:57, Jorge Ramirez wrote:
> On 08/04/2017 03:32 PM, Mark Thompson wrote:
>> On 04/08/17 14:06, Jorge Ramirez wrote:
>>> On 08/04/2017 01:51 PM, Mark Thompson wrote:
>>>>> +    if (ret)
>>>>> +        return 0;
>>>>> +
>>>>> +    return avpriv_v4l_dequeue(cap_pool, frame, NULL, timeout);
>>>>> +}
>>>> What happens to the decoder if some parameters like resolution change mid-stream?  (Try the stream h264/reinit-large_420_8-to-small_420_8.h264 in the fate samples.)
>>> yes, it breaks - the player still shows and image but it is corrupted.
>>> I am not sure how to handle this situation to be honest...so need to look into this.
>> There should be some way to detect it from the decoder, I think?  (I don't actually know how this works in V4L2.)
>> To compare, if you look at MMAL (perhaps the most similar API in current lavc) there is a special FORMAT_CHANGED return when dequeuing a frame, and the decoder is reconfigured with new buffers when that happens:<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/mmaldec.c;h=0b1195dc3e6f09beb74e3e47404456114596c499;hb=HEAD#l713>.
> great, thanks for that.
> The issue I have is that the V4L2 driver I am using to test - yes this needs to be detected by the decoder- has not implemented the feature yet. Will keep it in mind before sending the last series of the patchset.

Are they actually expecting the user to parse the stream externally to detect this case?  That wouldn't be too horrible to implement if many drivers are likely to have this problem - we already do essentially the same thing in the QSV decoder - see the parser use at <http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/qsvdec.c;h=c00817f1d93e533c75c186b3477bc83a78822aa9;hb=HEAD#l459>.

> also, I have rewritten the patchset to add clarity and clean some of the sedimentation from testing/hacking. is it ok with you if I post v4 now? it will simplify the discussion - the driver now much easier to follow.

Sure.  I'll go through it again within a few days.

- Mark

More information about the ffmpeg-devel mailing list