Skip to content

Conversation

@xianshijing-lk
Copy link
Contributor

As context:
queue_size_ms=0 is supposed to disable the buffer:

if (queue_size_samples_) {
int available =
(queue_size_samples_ + notify_threshold_samples_) - buffer_.size();
if (available < data.size())
return false;
if (on_complete_ || capture_userdata_)
return false;
buffer_.insert(buffer_.end(), data.begin(), data.end());
if (buffer_.size() <= notify_threshold_samples_) {
on_complete(ctx); // complete directly
} else {
on_complete_ = on_complete;
capture_userdata_ = ctx;
}
} else {
// capture directly when the queue buffer is 0 (frame size must be 10ms)
for (auto sink : sinks_)
sink->OnData(data.data(), sizeof(int16_t) * 8, sample_rate,
number_of_channels, number_of_frames);
}

But it is incorrectly handled in audio_source.rs:

for chunk in frame.data.chunks(self.queue_size_samples as usize) {

Calling chunks with 0 causes panic.

This PR implements the fast path that push the frame to webrtc directly

@xianshijing-lk xianshijing-lk requested a review from ladvoc November 4, 2025 03:56
Copy link
Contributor

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅, just one small suggestion.

@xianshijing-lk
Copy link
Contributor Author

I need to go out for a doctor appt, feel free to land it or wait until I am back this evening.

Thanks

@ladvoc ladvoc merged commit 0a193a4 into main Nov 4, 2025
22 of 23 checks passed
@ladvoc ladvoc deleted the sxian/CLT-1549/fix_fast_path_capture_frame branch November 4, 2025 05:17
@github-actions github-actions bot mentioned this pull request Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants