You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/desktop/src-tauri/src/upload.rs
+22-5Lines changed: 22 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ use cap_project::{RecordingMeta, S3UploadMeta, UploadMeta};
14
14
use cap_utils::spawn_actor;
15
15
use ffmpeg::ffi::AV_TIME_BASE;
16
16
use flume::Receiver;
17
-
use futures::{Stream,StreamExt,TryStreamExt, stream};
17
+
use futures::{Stream,StreamExt,TryStreamExt,future::join,stream};
18
18
use image::{ImageReader, codecs::jpeg::JpegEncoder};
19
19
use reqwest::StatusCode;
20
20
use serde::{Deserialize,Serialize};
@@ -629,17 +629,32 @@ fn multipart_uploader(
629
629
try_stream!{
630
630
letmut stream = pin!(stream);
631
631
letmut prev_part_number = None;
632
+
letmut expected_part_number = 1u32;
633
+
634
+
loop{
635
+
let(Some(item), presigned_url) = join(
636
+
stream.next(),
637
+
// We generate the presigned URL ahead of time for the part we expect to come next.
638
+
// If it's not the chunk that actually comes next we just throw it out.
639
+
// This means if the filesystem takes a while for the recording to reach previous total + CHUNK_SIZE, which is the common case, we aren't just doing nothing.
0 commit comments