Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Riedl <michael.riedl@nativewaves.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 1/1] libavdevice/decklink: extend available actions on signal loss
Date: Tue, 14 May 2024 11:42:44 +0200
Message-ID: <6c4c27be-ac9b-4351-be6a-b3dc347843f1@nativewaves.com> (raw)
In-Reply-To: <9e94a07b-21ac-50ad-1572-ac9327974b97@passwd.hu>

>
>> 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. To handle this, I add a reference to the DeckLink videoFrame to keep it valid and then release it (decreasing the reference counter) when it's no longer needed. Updating frameBytes multiple times should be okay since it just points to the raw frame buffer.

I ran some tests using Valgrind with and without the repeat option. I found a memory leak introduced by the patch because the destructor of decklink_input_callback is never called, which leaves one last video frame unreleased.

I'll work on fixing this memory leak and send an update soon. If you have any more comments or concerns, please let me know.

Best regards,
Michael Riedl

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-05-14  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  8:25 Michael Riedl
2024-05-07 22:47 ` Marton Balint
2024-05-14  9:42   ` Michael Riedl [this message]
2024-05-14 19:39     ` Marton Balint
2024-05-21  8:15       ` Michael Riedl
2024-06-11  9:19       ` [FFmpeg-devel] [PATCH v4] " Michael Riedl
2024-06-11  9:46         ` Michael Riedl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c4c27be-ac9b-4351-be6a-b3dc347843f1@nativewaves.com \
    --to=michael.riedl@nativewaves.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git