fix bad audio quality & save_to_disk example (#64)

- save_to_disk example: write raw pcm frames into a wav file
This commit is contained in:
Théo Monnom
2023-05-12 00:27:07 +02:00
committed by GitHub
parent e8d1c7ee73
commit f6954e3faa
8 changed files with 182 additions and 12 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ impl FfiAudioSream {
close_tx,
track_sid,
};
tokio::spawn(Self::native_audio_stream_task(
server.async_runtime.spawn(Self::native_audio_stream_task(
server,
audio_stream.handle_id,
NativeAudioStream::new(track),
+1 -1
View File
@@ -200,7 +200,7 @@ impl FfiServer {
publish: proto::PublishTrackRequest,
) -> FfiResult<proto::PublishTrackResponse> {
let async_id = self.next_id() as FfiAsyncId;
tokio::spawn(async move {
self.async_runtime.spawn(async move {
let res = async {
let room_handle = publish
.room_handle
+7 -5
View File
@@ -21,7 +21,7 @@ impl FfiRoom {
let session = room.session();
let next_id = server.next_id() as FfiHandleId;
let handle = tokio::spawn(room_task(
let handle = server.async_runtime.spawn(room_task(
server,
session.clone(),
next_id,
@@ -60,9 +60,11 @@ async fn room_task(
mut events: mpsc::UnboundedReceiver<livekit::RoomEvent>,
mut close_rx: oneshot::Receiver<()>,
) {
tokio::spawn(participant_task(Participant::Local(
session.local_participant(),
)));
server
.async_runtime
.spawn(participant_task(Participant::Local(
session.local_participant(),
)));
loop {
tokio::select! {
@@ -73,7 +75,7 @@ async fn room_task(
match event {
RoomEvent::ParticipantConnected(p) => {
tokio::spawn(participant_task(Participant::Remote(p)));
server.async_runtime.spawn(participant_task(Participant::Remote(p)));
}
_ => {}
}
+1 -1
View File
@@ -62,7 +62,7 @@ impl FfiVideoStream {
stream_type,
track_sid,
};
tokio::spawn(Self::native_video_stream_task(
server.async_runtime.spawn(Self::native_video_stream_task(
server,
video_stream.handle_id,
NativeVideoStream::new(track),