Skip to content

Commit 507a869

Browse files
committed
fix(rtmp): connect command
1 parent 8425037 commit 507a869

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

crates/amf0/src/de.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<'a, 'de> VariantAccess<'de> for Enum<'a> {
567567
#[cfg_attr(all(test, coverage_nightly), coverage(off))]
568568
mod tests {
569569
use core::f64;
570-
use std::collections::BTreeMap;
570+
use std::collections::HashMap;
571571
use std::fmt::Debug;
572572

573573
use bytes::Bytes;
@@ -915,7 +915,7 @@ mod tests {
915915
struct Test<'a> {
916916
b: String,
917917
#[serde(flatten, borrow)]
918-
other: BTreeMap<StringCow<'a>, Amf0Value<'a>>,
918+
other: HashMap<StringCow<'a>, Amf0Value<'a>>,
919919
}
920920

921921
let value: Test = from_bytes(Bytes::from_owner(bytes)).unwrap();

crates/amf0/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
//! ```rust
1919
//! # fn test() -> Result<(), Box<dyn std::error::Error>> {
2020
//! use scuffle_amf0::{Deserializer, Serializer};
21-
//! # let bytes = &[0x02, 0, 1, b'a'];
21+
//! # let payload = &[0x02, 0, 1, b'a'];
22+
//! # let bytes = bytes::Bytes::from_static(payload);
2223
//! # let mut writer = Vec::new();
2324
//!
2425
//! // Decode a string value from bytes
@@ -28,7 +29,7 @@
2829
//!
2930
//! // Encode a value into a writer
3031
//! scuffle_amf0::to_writer(&mut writer, &value)?;
31-
//! # assert_eq!(writer, bytes);
32+
//! # assert_eq!(writer, payload);
3233
//! # Ok(())
3334
//! # }
3435
//! # test().expect("test failed");

crates/flv/src/script.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Script data structures
22
3-
use std::collections::BTreeMap;
3+
use std::collections::HashMap;
44
use std::io;
55

66
use bytes::Bytes;
@@ -152,7 +152,7 @@ pub struct OnMetaData<'a> {
152152
pub video_track_id_info_map: Option<Amf0Object<'a>>,
153153
/// Any other metadata contained in the script data.
154154
#[serde(flatten, borrow)]
155-
pub other: BTreeMap<StringCow<'a>, Amf0Value<'a>>,
155+
pub other: HashMap<StringCow<'a>, Amf0Value<'a>>,
156156
}
157157

158158
/// XMP Metadata
@@ -169,7 +169,7 @@ pub struct OnXmpData<'a> {
169169
live_xml: Option<String>,
170170
/// Any other metadata contained in the script data.
171171
#[serde(flatten, borrow)]
172-
other: BTreeMap<StringCow<'a>, Amf0Value<'a>>,
172+
other: HashMap<StringCow<'a>, Amf0Value<'a>>,
173173
}
174174

175175
/// FLV `SCRIPTDATA` tag
@@ -279,7 +279,7 @@ mod tests {
279279
width: Some(1280.0),
280280
audio_track_id_info_map: None,
281281
video_track_id_info_map: None,
282-
other: BTreeMap::new(),
282+
other: HashMap::new(),
283283
}
284284
);
285285
}
@@ -351,7 +351,7 @@ mod tests {
351351
width: Some(1280.0),
352352
audio_track_id_info_map: Some([("test".into(), Amf0Value::Number(1.0))].into_iter().collect()),
353353
video_track_id_info_map: Some([("test2".into(), Amf0Value::Number(2.0))].into_iter().collect()),
354-
other: BTreeMap::new(),
354+
other: HashMap::new(),
355355
}
356356
);
357357
}

crates/rtmp/src/command_messages/netconnection/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! NetConnection command messages.
22
3-
use std::collections::BTreeMap;
3+
use std::collections::HashMap;
44

5-
use scuffle_amf0::Amf0Object;
5+
use scuffle_amf0::{Amf0Object, Amf0Value};
66
use scuffle_bytes_util::StringCow;
77

88
use super::on_status::OnStatusCode;
@@ -32,7 +32,7 @@ pub struct NetConnectionCommandConnect<'a> {
3232
/// - Legacy RTMP spec, page 30
3333
/// - Enhanced RTMP spec, page 36-37
3434
#[serde(flatten, borrow)]
35-
pub others: BTreeMap<StringCow<'a>, Amf0Object<'a>>,
35+
pub others: HashMap<StringCow<'a>, Amf0Value<'a>>,
3636
}
3737

3838
/// Extended capabilities mask used by the [enhanced connect command](NetConnectionCommandConnect).

crates/rtmp/src/session/server/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin, H: SessionHandler>
224224
&& self.caps_ex.is_some_and(|c| c.intersects(CapsExMask::Reconnect))
225225
&& self.ctx.as_ref().is_some_and(|ctx| ctx.is_done())
226226
{
227+
tracing::debug!("sending reconnect request");
228+
227229
OnStatus {
228230
code: OnStatusCode::NET_CONNECTION_CONNECT_RECONNECT_REQUEST,
229231
level: CommandResultLevel::Status,

0 commit comments

Comments
 (0)