Skip to content

Commit

Permalink
Fix cleanstream_filter_audio function to correctly set the output aud…
Browse files Browse the repository at this point in the history
…io timestamp
  • Loading branch information
royshil committed May 2, 2024
1 parent b6d1f7f commit 2381224
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/cleanstream-filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,12 @@ struct obs_audio_data *cleanstream_filter_audio(void *data, struct obs_audio_dat
// find needed number of frames from the incoming audio
size_t num_frames_needed = audio->frames;

gf->output_audio.timestamp = 0;

std::vector<float> temporary_buffers[MAX_AUDIO_CHANNELS];

while (temporary_buffers[0].size() < num_frames_needed) {
struct cleanstream_audio_info info_out = {0};
// pop from input buffers to get audio packet info
circlebuf_pop_front(&gf->info_buffer, &info_out, sizeof(info_out));
if (gf->output_audio.timestamp == 0) {
// the first packet, set the timestamp
gf->output_audio.timestamp = info_out.timestamp;
}

// pop from input circlebuf to audio data
for (size_t i = 0; i < gf->channels; i++) {
Expand Down Expand Up @@ -150,6 +144,7 @@ struct obs_audio_data *cleanstream_filter_audio(void *data, struct obs_audio_dat
}

gf->output_audio.frames = (uint32_t)num_frames;
gf->output_audio.timestamp = audio->timestamp;

return &gf->output_audio;
}
Expand Down

0 comments on commit 2381224

Please sign in to comment.