Quad card audio output issue

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

nikitadedov

  • Posts: 4
  • Joined: Fri May 20, 2022 9:56 am
  • Real Name: Nikita Dedov

Quad card audio output issue

PostTue Mar 14, 2023 3:39 pm

Hello,

We are writing application which get frames from input and send it to output, also we can play frames from files to output. It works well but with quad cards we have problems with audio. when we reinit output and start to send frames from file picture and tc is ok, but audio is broken (silence). strange but same code works well with 8k and duo cards. to send audio to output

to setup output, we are using
EnableVideoOutput
EnableAudioOutput
SetScheduledFrameCompletionCallback
SetAudioCallback
FlushBufferedAudioSamples
StartScheduledPlayback

Then I send 3 black frames to output, but no audio

Then we get RenderAudioSamples callback we called ScheduleAudioSamples. it return no error, and all samples is added. But nothing on output

Also I tried to call StartAudioPreroll and call StartScheduledPlayback when RenderAudioSamples called with preroll == true, and it stop to works at all.

If change ScheduleAudioSamples to WriteAudioSamplesSync audio works well, but we get breaks in audio sometimes

How it could be fix? or maybe I miss something

Thank you
Offline

Cameron Nichols

Blackmagic Design

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

Re: Quad card audio output issue

PostMon Mar 20, 2023 2:49 am

Hi Nikita,

Before you call IDeckLinkOutput::StartScheduledPlayback, ensure that you have sufficient audio samples and video frames in the scheduling queues. Ideally you should have sufficient audio samples equivalent to the number of prerolled video frames.

The IDeckLinkAudioOutputCallback::RenderAudioSamples callback is called periodically after IDeckLinkOutput::BeginAudioPreroll and is useful for maintaining the level of the buffered audio sample count after scheduled playback has started. During preroll, you can optionally use this callback to schedule video frames, as the IDeckLinkVideoOutputCallback::ScheduledFrameCompleted callback will only occur once scheduled playback has started.

Once you have both sufficient prerolled video frames and audio samples scheduled, then you should then call IDeckLinkOutput::StartScheduledPlayback. You can determine the buffered counts with IDeckLinkOutput::GetBufferedVideoFrameCount and IDeckLinkOutput::GetBufferedAudioSampleFrameCount, respectively.

My suspicion is that at the call to IDeckLinkOutput::StartScheduledPlayback, there are insufficient audio samples buffered, and so the DeckLink driver is outputting scheduled frames with no audio available at the requested stream time.

With respects to IDeckLinkOutput::WriteAudioSamplesSync, a call to this will write a limited number of samples into the driver to be played out immediately and bypassing the schedule audio buffer. This method is normally for writing short tones for output (as an example), but without using the schedule audio buffer it would be difficult to output continuous audio.

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: DroidU and 11 guests