@@ -177,7 +177,8 @@ class PlaybackDelegate : public IDeckLinkVideoOutputCallback // , public IDeckLi
177
177
178
178
bool EnqueueFrame (DeckLinkFrame *deckLinkFrame);
179
179
void ScheduleNextFrame ();
180
- void ScheduleAudio (const struct audio_frame *frame, uint32_t *samples);
180
+ void ScheduleAudio (const struct audio_frame *frame, uint32_t *samples,
181
+ bool underflow);
181
182
182
183
HRESULT STDMETHODCALLTYPE
183
184
ScheduledFrameCompleted (IDeckLinkVideoFrame *completedFrame,
@@ -1612,7 +1613,7 @@ static bool display_decklink_get_property(void *state, int property, void *val,
1612
1613
* AUDIO
1613
1614
*/
1614
1615
void PlaybackDelegate::ScheduleAudio (const struct audio_frame *frame,
1615
- uint32_t *const samples) {
1616
+ uint32_t *const samples, bool underflow ) {
1616
1617
if (m_adata.saved_sync_ts == INT64_MIN &&
1617
1618
m_audio_sync_ts == audio_sync_val::deinit) {
1618
1619
return ;
@@ -1642,6 +1643,15 @@ void PlaybackDelegate::ScheduleAudio(const struct audio_frame *frame,
1642
1643
LOG (LOG_LEVEL_ERROR) << MOD_NAME << " ScheduleAudioSamples: "
1643
1644
<< bmd_hresult_to_string (res) << " \n " ;
1644
1645
}
1646
+
1647
+ if (underflow) {
1648
+ static unsigned count;
1649
+ if (count++ == 50 ) {
1650
+ MSG (WARNING, " Excessive underflow in sync mode! Try to "
1651
+ " increase sync frames (:sync=%d or so).\n " ,
1652
+ m_min_sched_frames + 2 );
1653
+ }
1654
+ }
1645
1655
}
1646
1656
1647
1657
static void display_decklink_put_audio_frame (void *state, const struct audio_frame *frame)
@@ -1669,7 +1679,8 @@ static void display_decklink_put_audio_frame(void *state, const struct audio_fra
1669
1679
return ;
1670
1680
}
1671
1681
} else {
1672
- s->delegate .ScheduleAudio (frame, &sampleFramesWritten);
1682
+ s->delegate .ScheduleAudio (frame, &sampleFramesWritten,
1683
+ buffered == 0 );
1673
1684
}
1674
1685
const bool overflow = sampleFramesWritten != sampleFrameCount;
1675
1686
if (overflow || log_level >= LOG_LEVEL_DEBUG) {
0 commit comments