Skip to content

Commit

Permalink
coreaudio: assert that frames match bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
tguillem authored and jbkempf committed Dec 2, 2022
1 parent c41a355 commit db64c39
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/audio_output/coreaudio_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,18 @@ RenderCallback(void *p_data, AudioUnitRenderActionFlags *ioActionFlags,
VLC_UNUSED(ioActionFlags);
VLC_UNUSED(inTimeStamp);
VLC_UNUSED(inBusNumber);

audio_output_t * p_aout = p_data;
struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys;

assert(inNumberFrames == BytesToFrames(p_sys, ioData->mBuffers[0].mDataByteSize));
VLC_UNUSED(inNumberFrames);

uint64_t i_host_time = (inTimeStamp->mFlags & kAudioTimeStampHostTimeValid)
? inTimeStamp->mHostTime : 0;

bool is_silence;
ca_Render(p_data, i_host_time, ioData->mBuffers[0].mData,
ca_Render(p_aout, i_host_time, ioData->mBuffers[0].mData,
ioData->mBuffers[0].mDataByteSize, &is_silence);
if (is_silence)
*ioActionFlags |= kAudioUnitRenderAction_OutputIsSilence;
Expand Down

0 comments on commit db64c39

Please sign in to comment.