Decklink playback audio issue when reference is flipping

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Jerzy Jaśkiewicz

  • Posts: 14
  • Joined: Thu Dec 17, 2015 12:16 pm

Decklink playback audio issue when reference is flipping

PostFri May 13, 2022 12:04 pm

TLDR:
Decklink: When reference input is flipping during scheduled playback, audio buffer is consumed to end. This causes lip-sync problems, and ultimately breaks audio output.
The lip-sync problem can be easily observed in Media Express, and the observed delay was huge even after first reference lock, however I was not able to break the audio completely.

Tested on Decklink 8K Pro with 11.5.1 and 12.3 drivers, using PAL blackburst as reference.
Playing standard vistek test, it becomes clear that during syncing to input reference, video is delayed to be in sync in reference (for unknown reason there are also some black frames at output), but audio plays uninterrupted, what results in consuming audio samples, while not consuming video (because of the wait).

Using standard IDecklinkOutput::StartScheduledPlayback after IDecklinkOutput::EnableAudioOutput with BMDAudioOutputStreamType::bmdAudioOutputStreamTimestamped and correct timestamping of the samples and video.
A workaround was implemented in https://github.com/jaskie/Server/commit/9d4aff7b03d35df27c35ec3dead689fc9eeb6699, but it not ensure precise samples addendum.
Offline

Mitra Mahmoodzadeh

  • Posts: 53
  • Joined: Wed Sep 02, 2015 2:45 pm

Re: Decklink playback audio issue when reference is flipping

PostFri Jul 28, 2023 7:25 pm

I have the same problem with Duo 2 card, and that workaround does not work for me.
Tested with 11.4 and 12.1 drivers.

I hope one of the Blackmagic experts will provide a solution for this problem.
Offline

Jerzy Jaśkiewicz

  • Posts: 14
  • Joined: Thu Dec 17, 2015 12:16 pm

Re: Decklink playback audio issue when reference is flipping

PostMon Jul 31, 2023 5:27 pm

I posted the issue to BMD EMEA support. They proved not to understand the issue, I gave up and resolved it by stopping and starting again the playback after reference was locked. It just takes much longer and produces more visual artifacts (black frames are visible twice for about 2 seconds), but the overall result is acceptable, unless somebody in facility starts playing with reference source ;-)
Offline

Mitra Mahmoodzadeh

  • Posts: 53
  • Joined: Wed Sep 02, 2015 2:45 pm

Re: Decklink playback audio issue when reference is flipping

PostTue Aug 01, 2023 9:41 am

Jerzy Jaśkiewicz wrote: They proved not to understand the issue
:( :o :cry: :evil: :lol:
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Decklink playback audio issue when reference is flipping

PostFri Aug 04, 2023 12:58 pm

Hi Mitra,

I recommend that changing reference input should require stop and start playback. This is because the output will need to relock to the reference again which may have a short period of invalid output.

If your setup needs to handle cases of reference input switching, then I suggest monitoring the status item bmdDeckLinkStatusReferenceSignalLocked. To receive notification of reference locking change, you should implement the following:
  1. Create a class that implements IDeckLinkNotificationCallback[1]. Implement all methods including IUnknown.
  2. In your implementation of IDeckLinkNotificationCallback::Notify, filter for topic == bmdStatusChanged[2] and param1 == bmdDeckLinkStatusReferenceSignalLocked[3].
  3. Obtain IDeckLinkStatus[4] object from IDeckLink by calling QueryInterface.
  4. Call IDeckLinkStatus::GetFlag with status ID bmdDeckLinkStatusReferenceSignalLocked to get current reference lock state.
  5. Obtain IDeckLinkNotification[5] object from IDeckLink by calling QueryInterface.
  6. Subscribe to notifications by calling IDeckLinkNotification::Subscribe with topic bmdStatusChanged and your custom callback class.
  7. At end of application unsubscribe to the notification callback by calling IDeckLinkNotification::Unsubscribe.
When the reference lock state changes from true to false, then stop scheduled playback IDeckLinkOutput::StopScheduledPlayback. When reference lock state is true then restart playback with IDeckLinkOutput::StartScheduledPlayback.

Regards
Cameron

References (DeckLink SDK Manual)
[1] 2.5.34 IDeckLinkNotificationCallback Interface
[2] 3.43 DeckLink Device Notification
[3] 3.59 DeckLink Status ID
[4] 2.5.42 IDeckLinkStatus Interface
[5] 2.5.33 IDeckLinkNotification Interface
Offline

Mitra Mahmoodzadeh

  • Posts: 53
  • Joined: Wed Sep 02, 2015 2:45 pm

Re: Decklink playback audio issue when reference is flipping

PostSat Aug 05, 2023 8:42 am

@Cameron, As always, your answer was perfect, I will implement it, thank you very much for your explanation and support.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 12 guests