diff --git a/src/client/mod.rs b/src/client/mod.rs index 6a6b966..f2a37e3 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1488,21 +1488,18 @@ impl Session { description, }) })?; - match inner.session.as_ref() { - Some(SessionHeader { id, .. }) if id.as_ref() != &*response.session.id => { - bail!(ErrorInt::RtspResponseError { - conn_ctx: *conn.inner.ctx(), - msg_ctx, - method: rtsp_types::Method::Setup, - cseq, - status, - description: format!( - "session id changed from {:?} to {:?}", - id, response.session.id, - ), - }); + + match inner.session.as_mut() { + Some(sess_header) => { + if sess_header.id.as_ref() != &*response.session.id { + debug!( + "reestablished session {:?}(was {:?}), timeout={}s", + response.session.id, sess_header.id, response.session.timeout_sec + ); + *sess_header = response.session; + } } - Some(_) => {} + None => { debug!( "established session {:?}, timeout={}s", @@ -1511,6 +1508,7 @@ impl Session { *inner.session = Some(response.session) } }; + let conn_ctx = conn.inner.ctx(); let (stream_ctx, udp_sockets); match udp { diff --git a/src/lib.rs b/src/lib.rs index 38de38b..827e198 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ struct ReceivedMessage { /// codec-specified clock rate. /// * the full timestamp. /// * NPT -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct Timestamp { /// A timestamp which must be compared to `start`. timestamp: i64, @@ -171,12 +171,6 @@ impl Display for Timestamp { } } -impl Debug for Timestamp { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - Display::fmt(self, f) - } -} - /// The Unix epoch as an [`NtpTimestamp`]. pub const UNIX_EPOCH: NtpTimestamp = NtpTimestamp((2_208_988_800) << 32);