-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
539 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# i die on this hill | ||
hard_tabs = true | ||
max_width = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
use bytes::{Bytes, BytesMut}; | ||
|
||
pub struct EncodedFrame { | ||
pub payload: Bytes, | ||
pub timestamp: f64, | ||
pub keyframe: bool, | ||
pub payload: Bytes, | ||
pub timestamp: f64, | ||
pub keyframe: bool, | ||
} | ||
|
||
impl From<web_sys::EncodedVideoChunk> for EncodedFrame { | ||
fn from(chunk: web_sys::EncodedVideoChunk) -> Self { | ||
let size = chunk.byte_length() as usize; | ||
fn from(chunk: web_sys::EncodedVideoChunk) -> Self { | ||
let size = chunk.byte_length() as usize; | ||
|
||
let mut payload = BytesMut::with_capacity(size); | ||
payload.resize(size, 0); | ||
chunk.copy_to_with_u8_slice(&mut payload).unwrap(); | ||
let mut payload = BytesMut::with_capacity(size); | ||
payload.resize(size, 0); | ||
chunk.copy_to_with_u8_slice(&mut payload).unwrap(); | ||
|
||
Self { | ||
payload: payload.freeze(), | ||
timestamp: chunk.timestamp(), | ||
keyframe: chunk.type_() == web_sys::EncodedVideoChunkType::Key, | ||
} | ||
} | ||
Self { | ||
payload: payload.freeze(), | ||
timestamp: chunk.timestamp(), | ||
keyframe: chunk.type_() == web_sys::EncodedVideoChunkType::Key, | ||
} | ||
} | ||
} | ||
|
||
impl From<web_sys::EncodedAudioChunk> for EncodedFrame { | ||
fn from(chunk: web_sys::EncodedAudioChunk) -> Self { | ||
let size = chunk.byte_length() as usize; | ||
fn from(chunk: web_sys::EncodedAudioChunk) -> Self { | ||
let size = chunk.byte_length() as usize; | ||
|
||
let mut payload = BytesMut::with_capacity(size); | ||
payload.resize(size, 0); | ||
chunk.copy_to_with_u8_slice(&mut payload).unwrap(); | ||
let mut payload = BytesMut::with_capacity(size); | ||
payload.resize(size, 0); | ||
chunk.copy_to_with_u8_slice(&mut payload).unwrap(); | ||
|
||
Self { | ||
payload: payload.freeze(), | ||
timestamp: chunk.timestamp(), | ||
keyframe: chunk.type_() == web_sys::EncodedAudioChunkType::Key, | ||
} | ||
} | ||
Self { | ||
payload: payload.freeze(), | ||
timestamp: chunk.timestamp(), | ||
keyframe: chunk.type_() == web_sys::EncodedAudioChunkType::Key, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.