Skip to content

Commit

Permalink
Updated NTgCall::get_params function, its now return a string inste…
Browse files Browse the repository at this point in the history
…ad of bytes and added `Default` Implementation to `MediaDescription`.
  • Loading branch information
YouKnow-sys committed Mar 16, 2024
1 parent 08f6173 commit 76d1bf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ntgcalls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl NTgCall {
/// - [`NTgCallError::FFmpegNotFound`]
/// - [`NTgCallError::ShellError`]
/// - [`NTgCallError::UnknownException`]
pub fn get_params(&self, chat_id: i64, desc: MediaDescription) -> NTgCallResult<Vec<u8>> {
pub fn get_params(&self, chat_id: i64, desc: MediaDescription) -> NTgCallResult<String> {
let mut buf = vec![0; 512];

let audio = desc.audio.as_ref().map(AudioDescription::to_ffi);
Expand All @@ -139,7 +139,9 @@ impl NTgCall {
return Err(NTgCallError::from(result));
}

Ok(buf)
Ok(String::from_utf8(buf).expect(
"GetParams function returned invalid string. this is a internal error, report it",
))
}

/// This method allow stopping a WebRTC connection.
Expand Down
2 changes: 1 addition & 1 deletion ntgcalls/src/structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};

/// Media Configuration for the Stream.
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct MediaDescription {
/// Audio configuration for the stream.
pub audio: Option<AudioDescription>,
Expand Down

0 comments on commit 76d1bf7

Please sign in to comment.