Skip to content

Commit 1526bb3

Browse files
committed
no more peek iter :(
1 parent 8732e43 commit 1526bb3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/recording/examples/recording-cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub async fn main() {
6363
},
6464
)
6565
.with_system_audio(true)
66-
.with_mic_feed(std::sync::Arc::new(
67-
mic_feed.ask(microphone::Lock).await.unwrap(),
68-
))
66+
// .with_mic_feed(std::sync::Arc::new(
67+
// mic_feed.ask(microphone::Lock).await.unwrap(),
68+
// ))
6969
.build()
7070
.await
7171
.unwrap();

crates/recording/src/sources/audio_mixer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tracing::debug;
1515
// Current problem is generating an output timestamp that lines up with the input's timestamp
1616

1717
struct MixerSource {
18-
rx: std::iter::Peekable<flume::IntoIter<(ffmpeg::frame::Audio, Timestamp)>>,
18+
rx: Receiver<(ffmpeg::frame::Audio, Timestamp)>,
1919
info: AudioInfo,
2020
buffer: VecDeque<(ffmpeg::frame::Audio, Timestamp)>,
2121
buffer_last: Option<(Timestamp, Duration)>,
@@ -41,7 +41,7 @@ impl AudioMixerBuilder {
4141
pub fn add_source(&mut self, info: AudioInfo, rx: Receiver<(ffmpeg::frame::Audio, Timestamp)>) {
4242
self.sources.push(MixerSource {
4343
info,
44-
rx: rx.into_iter().peekable(),
44+
rx,
4545
buffer: VecDeque::new(),
4646
buffer_last: None,
4747
});
@@ -184,7 +184,7 @@ impl AudioMixer {
184184
}
185185
}
186186

187-
while let Some((frame, timestamp)) = source.rx.next() {
187+
while let Ok((frame, timestamp)) = source.rx.try_recv() {
188188
// if gap between incoming and last, insert silence
189189
if let Some((buffer_last_timestamp, buffer_last_duration)) = source.buffer_last {
190190
let timestamp_elapsed = timestamp.duration_since(self.timestamps);

0 commit comments

Comments
 (0)