switch from try_recv to try_iter
This commit is contained in:
parent
f3eb5da16f
commit
0c2ee7726b
@ -53,8 +53,7 @@ pub fn player(
|
|||||||
rt_handle.spawn(stderr_reader(enc_proc.stderr.take().unwrap(), "Encoder"));
|
rt_handle.spawn(stderr_reader(enc_proc.stderr.take().unwrap(), "Encoder"));
|
||||||
*proc_control.decoder_term.lock().unwrap() = Some(enc_proc);
|
*proc_control.decoder_term.lock().unwrap() = Some(enc_proc);
|
||||||
|
|
||||||
// too small value for channel size increases CPU load,
|
let (ingest_sender, ingest_receiver) = bounded(96);
|
||||||
let (ingest_sender, ingest_receiver) = bounded(56);
|
|
||||||
|
|
||||||
if config.ingest.enable {
|
if config.ingest.enable {
|
||||||
rt_handle.spawn(ingest_server(
|
rt_handle.spawn(ingest_server(
|
||||||
@ -132,9 +131,9 @@ pub fn player(
|
|||||||
*playlist_init.lock().unwrap() = true;
|
*playlist_init.lock().unwrap() = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(receive) = ingest_receiver.try_recv() {
|
for rx in ingest_receiver.try_iter() {
|
||||||
if let Err(e) = enc_writer.write(&receive.1[..receive.0]) {
|
if let Err(e) = enc_writer.write(&rx.1[..rx.0]) {
|
||||||
error!("Ingest receiver error: {:?}", e);
|
error!("Encoder write error: {:?}", e);
|
||||||
|
|
||||||
break 'source_iter;
|
break 'source_iter;
|
||||||
};
|
};
|
||||||
@ -147,16 +146,6 @@ pub fn player(
|
|||||||
error!("Encoder error: {e}")
|
error!("Encoder error: {e}")
|
||||||
}
|
}
|
||||||
|
|
||||||
let rest_from_receiver: Vec<_> = ingest_receiver.try_iter().collect();
|
|
||||||
|
|
||||||
for rest in rest_from_receiver {
|
|
||||||
if let Err(e) = enc_writer.write(&rest.1[..rest.0]) {
|
|
||||||
error!("Encoder write error: {:?}", e);
|
|
||||||
|
|
||||||
break 'source_iter;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
live_on = false;
|
live_on = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user