Page 1 of 1

DisplayVideoFrameSync with scheduled audio playback

PostPosted: Fri Oct 12, 2018 9:59 am
by zwang135
Can I use DisplayVideoFrameSync method with scheduled audio playback? Thanks!

Re: DisplayVideoFrameSync with scheduled audio playback

PostPosted: Thu Oct 18, 2018 4:26 am
by Cameron Nichols
Hi Zicheng,

When not using scheduled playback, the preferred flow is to use IDeckLinkOutput::WriteAudioSamplesSync.

Can I understand the use-case for your request?

Regards
Cameron

Re: DisplayVideoFrameSync with scheduled audio playback

PostPosted: Mon Oct 22, 2018 2:26 am
by zwang135
Cameron Nichols wrote:Hi Zicheng,

When not using scheduled playback, the preferred flow is to use IDeckLinkOutput::WriteAudioSamplesSync.

Can I understand the use-case for your request?

Regards
Cameron

Hi Cameron,

I tried WriteAudioSamplesSync but the output sounded discontinuous, then I changed both video and audio to scheduled playback. Now I'm having a problem that GetBufferedAudioSampleFrameCount returns E_ACCESSDENIED sometimes, how do I avoid this?

Thanks!
Zicheng Wang

Re: DisplayVideoFrameSync with scheduled audio playback

PostPosted: Thu Oct 25, 2018 2:21 am
by zwang135
zwang135 wrote:Hi Cameron,

I tried WriteAudioSamplesSync but the output sounded discontinuous, then I changed both video and audio to scheduled playback. Now I'm having a problem that GetBufferedAudioSampleFrameCount returns E_ACCESSDENIED sometimes, how do I avoid this?

Thanks!
Zicheng Wang

An update of the issue:

This happens when I stop capturing and start playback immediately. My capture and playback work fine separately, just when switching from capture to playback it crashes sometimes. I guess it might be because the playback starts before the capture actually stops sometimes? When switching from playback to capture my program works fine, since I put my start-capture method in the ScheduledPlaybackHasStopped callback, but I don't see a similar callback for capture.

Can I have some advice for this problem? Or is it better not to use scheduled playback? Thanks!

Re: DisplayVideoFrameSync with scheduled audio playback

PostPosted: Wed Oct 31, 2018 1:03 am
by Cameron Nichols
Hi Zicheng,

As a followup from my previous post, the preferred mechanism for having scheduled audio playback is to use IDeckLinkOutput::ScheduleVideoFrame, called once with a single frame that will remain to screen, then you can safely use RenderAudioSamples.

You should not put calls to the DeckLinkAPI within the context of ScheduledPlaybackHasStopped callback. Instead you should add a mutex/conditional variable and make your calls to StartStreams outside of the callback context.

We have updated SignalGenerator/TestPattern samples in Desktop Video SDK 10.11.4 to demonstrate correct stop playback synchronisation.

Regards
Cameron