[FFmpeg-devel] [PATCH v2 1/1] libavdevice/decklink: extend available actions on signal loss

Marton Balint cus at passwd.hu
Tue May 14 22:39:39 EEST 2024



On Tue, 14 May 2024, Michael Riedl wrote:

>>
>>> Deprecate the option 'draw_bars' in favor of the new option 'signal_loss_action',
>>> which controls the behavior when the input signal is not available
>>> (including the behavior previously available through draw_bars).
>>> The default behavior remains unchanged to be backwards compatible.
>>> The new option is more flexible for extending now and in the future.
>>>
>>> The new value 'repeat' repeats the last video frame.
>>> This is useful for very short dropouts and was not available before.
>>
>> As far as I see, you are overriding frameBytes for a repeated frame, that seems wrong. pkt.data (frameBytes) must be associated with the videoFrame which is passed to av_buffer_create() later on.
>>
>> Every AVFrame returned by the decklink device has an AVBuffer set up which
>> keeps a reference to the original DeckLink frame. This allows the use of the DeckLink frame's raw buffer directly. But you cannot use the raw buffer of another DeckLink frame for which the AVBuffer of the AVFrame does not keep a reference.
>
> Thank you for your feedback!
>
> I took another look at the code and revisited the DeckLink documentation 
> to ensure my understanding was correct. It seems that frameBytes is a 
> pointer to the buffer of an IDeckLinkVideoFrame, and it remains valid as 
> long as the videoFrame is not released.

That is just it. You are releasing the repeated frame as soon as a valid 
frame comes in. The AVPacket data you previously returned will still point 
to the now released frameBytes. As I wrote above, the decklink frame 
corresponding to the returned frameBytes must be released in the 
destructor of the AVPacket buffer.

Regards,
Marton


More information about the ffmpeg-devel mailing list