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

Bring back RTP and RTCP notifications (#1455)

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