Unverified 提交 df0074b5 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi 提交者: GitHub

Bring back RTP and RTCP notifications (#1455)

上级 4e161f6b
...@@ -1354,7 +1354,7 @@ checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" ...@@ -1354,7 +1354,7 @@ checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909"
[[package]] [[package]]
name = "mediasoup" name = "mediasoup"
version = "0.17.0" version = "0.17.1"
dependencies = [ dependencies = [
"actix", "actix",
"actix-web", "actix-web",
...@@ -1391,7 +1391,7 @@ dependencies = [ ...@@ -1391,7 +1391,7 @@ dependencies = [
[[package]] [[package]]
name = "mediasoup-sys" name = "mediasoup-sys"
version = "0.9.0" version = "0.9.1"
dependencies = [ dependencies = [
"planus", "planus",
"planus-codegen", "planus-codegen",
......
...@@ -593,8 +593,7 @@ enum Notification { ...@@ -593,8 +593,7 @@ enum Notification {
ProducerClose, ProducerClose,
ProducerPause, ProducerPause,
ProducerResume, ProducerResume,
// TODO. Rtp(Vec<u8>),
// Rtp,
Score(ConsumerScore), Score(ConsumerScore),
LayersChange(Option<ConsumerLayers>), LayersChange(Option<ConsumerLayers>),
Trace(ConsumerTraceEventData), Trace(ConsumerTraceEventData),
...@@ -608,6 +607,17 @@ impl Notification { ...@@ -608,6 +607,17 @@ impl Notification {
notification::Event::ConsumerProducerClose => Ok(Notification::ProducerClose), notification::Event::ConsumerProducerClose => Ok(Notification::ProducerClose),
notification::Event::ConsumerProducerPause => Ok(Notification::ProducerPause), notification::Event::ConsumerProducerPause => Ok(Notification::ProducerPause),
notification::Event::ConsumerProducerResume => Ok(Notification::ProducerResume), notification::Event::ConsumerProducerResume => Ok(Notification::ProducerResume),
notification::Event::ConsumerRtp => {
let Ok(Some(notification::BodyRef::ConsumerRtpNotification(body))) =
notification.body()
else {
panic!("Wrong message from worker: {notification:?}");
};
let rtp_notification_fbs = consumer::RtpNotification::try_from(body).unwrap();
Ok(Notification::Rtp(rtp_notification_fbs.data))
}
notification::Event::ConsumerScore => { notification::Event::ConsumerScore => {
let Ok(Some(notification::BodyRef::ConsumerScoreNotification(body))) = let Ok(Some(notification::BodyRef::ConsumerScoreNotification(body))) =
notification.body() notification.body()
...@@ -841,14 +851,11 @@ impl Consumer { ...@@ -841,14 +851,11 @@ impl Consumer {
handlers.resume.call_simple(); handlers.resume.call_simple();
} }
} }
/* Notification::Rtp(data) => {
* TODO.
Notification::Rtp => {
handlers.rtp.call(|callback| { handlers.rtp.call(|callback| {
callback(notification); callback(&data);
}); });
} }
*/
Notification::Score(consumer_score) => { Notification::Score(consumer_score) => {
*score.lock() = consumer_score.clone(); *score.lock() = consumer_score.clone();
handlers.score.call_simple(&consumer_score); handlers.score.call_simple(&consumer_score);
......
...@@ -231,8 +231,7 @@ struct Handlers { ...@@ -231,8 +231,7 @@ struct Handlers {
#[serde(tag = "event", rename_all = "lowercase", content = "data")] #[serde(tag = "event", rename_all = "lowercase", content = "data")]
enum Notification { enum Notification {
Trace(TransportTraceEventData), Trace(TransportTraceEventData),
// TODO. Rtcp(Vec<u8>),
// Rtcp,
} }
impl Notification { impl Notification {
...@@ -252,17 +251,18 @@ impl Notification { ...@@ -252,17 +251,18 @@ impl Notification {
Ok(Notification::Trace(trace_notification)) Ok(Notification::Trace(trace_notification))
} }
/*
* TODO.
notification::Event::DirecttransportRtcp => { notification::Event::DirecttransportRtcp => {
let Ok(Some(notification::BodyRef::RtcpNotification(_body))) = notification.body() let Ok(Some(notification::BodyRef::DirectTransportRtcpNotification(body))) =
notification.body()
else { else {
panic!("Wrong message from worker: {notification:?}"); panic!("Wrong message from worker: {notification:?}");
}; };
Ok(Notification::Rtcp) let rtcp_notification_fbs =
direct_transport::RtcpNotification::try_from(body).unwrap();
Ok(Notification::Rtcp(rtcp_notification_fbs.data))
} }
*/
_ => Err(NotificationParseError::InvalidEvent), _ => Err(NotificationParseError::InvalidEvent),
} }
} }
...@@ -574,14 +574,12 @@ impl DirectTransport { ...@@ -574,14 +574,12 @@ impl DirectTransport {
Ok(notification) => match notification { Ok(notification) => match notification {
Notification::Trace(trace_event_data) => { Notification::Trace(trace_event_data) => {
handlers.trace.call_simple(&trace_event_data); handlers.trace.call_simple(&trace_event_data);
} /* }
* TODO. Notification::Rtcp(data) => {
Notification::Rtcp => {
handlers.rtcp.call(|callback| { handlers.rtcp.call(|callback| {
callback(notification); callback(&data);
}); });
} }
*/
}, },
Err(error) => { Err(error) => {
error!("Failed to parse notification: {}", error); error!("Failed to parse notification: {}", error);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论