[FFmpeg-devel] [PATCH 1/1] avdevice/decklink_dec: Autodetect the video input format

Jeyapal, Karthick kjeyapal at akamai.com
Mon Nov 20 13:42:47 EET 2017

>On 11/20/17, 12:39 AM, "Marton Balint" <cus at passwd.hu> wrote:

>Thanks, there is one more thing I still don't get:

>> +    // 1 second timeout
>> +    for (i = 0; i < 10; i++) {
>> +        av_usleep(100000);
>> +        // Sometimes VideoInputFrameArrived is called before VideoInputFormatChanged
>> +        // So don't break for bmd_mode == AUTODETECT_DEFAULT_MODE

>Even if you get a frame for the default mode, and 
>VideoInputFrameArrived is called early, the bmdFrameHasNoInputSource 
>flag should be set, so ctx->bmd_mode remains unknown, therefore you don't 
>have to handle it specially.
>Are you saying that the Decklink drivers are buggy, and there are cases 
>where you get a frame without the bmdFrameHasNoInputSource flag, and then 
>a VideoInputFormatChanged callback later?

Yes, there are cases where you get a frame without the bmdFrameHasNoInputSource
flag, and then a VideoInputFormatChanged called later. And it is random.
But I don’t know if it could be called as a driver bug, since the getWidth and getHeight would return the correct values.
During my testing, I observed a 1080p30 would randomly get detected as,
AUTODETECT_DEFAULT_MODE because of VideoInputFrameArrived called early.
Hence I added that extra condition to handle it specially.

>> +        if (ctx->bmd_mode != bmdModeUnknown &&
>> +            ctx->bmd_mode != AUTODETECT_DEFAULT_MODE)
>> +            break;
>> +    }
>> +




More information about the ffmpeg-devel mailing list