Skip to content

Commit 9a76168

Browse files
committed
compilation fix
1 parent fa346c7 commit 9a76168

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/encoder.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use windows::Storage::Streams::{
2424
Buffer, DataReader, IRandomAccessStream, InMemoryRandomAccessStream, InputStreamOptions,
2525
};
2626
use windows::Storage::{FileAccessMode, StorageFile};
27-
use windows::core::{HSTRING, Interface};
27+
use windows::core::{Array, HSTRING, Interface};
2828

2929
use crate::d3d11::SendDirectX;
3030
use crate::frame::{Frame, ImageFormat};
@@ -1408,10 +1408,11 @@ impl StreamingVideoEncoder {
14081408

14091409
// Extract encoded audio data and send to callback
14101410
let audio_data = sample.Buffer()?;
1411-
let audio_buffer = CryptographicBuffer::CopyToByteArray(&audio_data)?;
1412-
1411+
let mut audio_array: Array<u8> = Array::new();
1412+
CryptographicBuffer::CopyToByteArray(&audio_data, &mut audio_array)?;
1413+
14131414
let encoded_audio = EncodedAudioFrame {
1414-
data: audio_buffer.to_vec(),
1415+
data: audio_array.as_slice().to_vec(),
14151416
timestamp: timestamp.Duration,
14161417
sample_count: audio_encoding_properties.SampleRate()? / 1000, // Approximate
14171418
};
@@ -1461,10 +1462,11 @@ impl StreamingVideoEncoder {
14611462

14621463
// Extract encoded video data and send to callback
14631464
let video_data = sample.Buffer()?;
1464-
let video_buffer = CryptographicBuffer::CopyToByteArray(&video_data)?;
1465-
1465+
let mut video_array: Array<u8> = Array::new();
1466+
CryptographicBuffer::CopyToByteArray(&video_data, &mut video_array)?;
1467+
14661468
let encoded_frame = EncodedFrame {
1467-
data: video_buffer.to_vec(),
1469+
data: video_array.as_slice().to_vec(),
14681470
timestamp: timestamp.Duration,
14691471
frame_type: FrameType::DeltaFrame, // Default, could be determined from sample properties
14701472
width: video_encoding_properties.Width()?,
@@ -1745,4 +1747,4 @@ impl Drop for StreamingVideoEncoder {
17451747
}
17461748

17471749
#[allow(clippy::non_send_fields_in_send_ty)]
1748-
unsafe impl Send for StreamingVideoEncoder {}
1750+
unsafe impl Send for StreamingVideoEncoder {}

src/network.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::net::{TcpListener, TcpStream, UdpSocket};
33
use std::sync::{Arc, Mutex};
44
use std::thread;
55
use std::time::{Duration, Instant};
6+
use std::io::Write;
67

78
use crate::encoder::{EncodedFrame, EncodedAudioFrame, FrameCallback};
89

@@ -128,7 +129,7 @@ impl TcpStreamServer {
128129
let frame_data = self.serialize_frame(&frame)?;
129130

130131
// Remove disconnected clients
131-
clients.retain(|client| {
132+
clients.retain(|mut client| {
132133
if let Err(_) = client.write_all(&frame_data) {
133134
false
134135
} else {

0 commit comments

Comments
 (0)