mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Combine setters for protection payload types (red and ulpfec)
Bug: webrtc:11993 Change-Id: Ibd1402ac1b77d0484c3a97e9a758ed9e588615eb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271640 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37787}
This commit is contained in:
parent
ab6233708c
commit
e1bd833f9d
7 changed files with 23 additions and 48 deletions
|
@ -303,9 +303,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
|
|||
// Must be called on the packet delivery thread.
|
||||
virtual void SetNackHistory(TimeDelta history) = 0;
|
||||
|
||||
virtual void SetUlpfecPayloadType(int ulpfec_payload_type) = 0;
|
||||
|
||||
virtual void SetRedPayloadType(int red_payload_type) = 0;
|
||||
virtual void SetProtectionPayloadTypes(int red_payload_type,
|
||||
int ulpfec_payload_type) = 0;
|
||||
|
||||
virtual void SetRtcpXr(Config::Rtp::RtcpXr rtcp_xr) = 0;
|
||||
|
||||
|
|
|
@ -298,12 +298,10 @@ class FakeVideoReceiveStream final
|
|||
config_.rtp.nack.rtp_history_ms = history.ms();
|
||||
}
|
||||
|
||||
void SetUlpfecPayloadType(int ulpfec_payload_type) override {
|
||||
config_.rtp.ulpfec_payload_type = ulpfec_payload_type;
|
||||
}
|
||||
|
||||
void SetRedPayloadType(int red_payload_type) override {
|
||||
void SetProtectionPayloadTypes(int red_payload_type,
|
||||
int ulpfec_payload_type) override {
|
||||
config_.rtp.red_payload_type = red_payload_type;
|
||||
config_.rtp.ulpfec_payload_type = ulpfec_payload_type;
|
||||
}
|
||||
|
||||
void SetRtcpXr(Config::Rtp::RtcpXr rtcp_xr) override {
|
||||
|
|
|
@ -2974,17 +2974,12 @@ bool WebRtcVideoChannel::WebRtcVideoReceiveStream::ReconfigureCodecs(
|
|||
|
||||
const auto& codec = recv_codecs.front();
|
||||
|
||||
if (config_.rtp.red_payload_type != codec.ulpfec.red_payload_type) {
|
||||
config_.rtp.red_payload_type = codec.ulpfec.red_payload_type;
|
||||
stream_->SetRedPayloadType(codec.ulpfec.red_payload_type);
|
||||
}
|
||||
|
||||
// Check and optionally set `ulpfec_payload_type` _after_ checking the
|
||||
// `red_payload_type` due to encapsulation. See RtpVideoStreamReceiver2
|
||||
// for more details.
|
||||
if (config_.rtp.ulpfec_payload_type != codec.ulpfec.ulpfec_payload_type) {
|
||||
if (config_.rtp.red_payload_type != codec.ulpfec.red_payload_type ||
|
||||
config_.rtp.ulpfec_payload_type != codec.ulpfec.ulpfec_payload_type) {
|
||||
config_.rtp.ulpfec_payload_type = codec.ulpfec.ulpfec_payload_type;
|
||||
stream_->SetUlpfecPayloadType(config_.rtp.ulpfec_payload_type);
|
||||
config_.rtp.red_payload_type = codec.ulpfec.red_payload_type;
|
||||
stream_->SetProtectionPayloadTypes(config_.rtp.red_payload_type,
|
||||
config_.rtp.ulpfec_payload_type);
|
||||
}
|
||||
|
||||
const bool has_lntf = HasLntf(codec.codec);
|
||||
|
|
|
@ -1003,31 +1003,19 @@ int RtpVideoStreamReceiver2::ulpfec_payload_type() const {
|
|||
return ulpfec_receiver_ ? ulpfec_receiver_->ulpfec_payload_type() : -1;
|
||||
}
|
||||
|
||||
void RtpVideoStreamReceiver2::set_ulpfec_payload_type(int payload_type) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
ulpfec_receiver_ = MaybeConstructUlpfecReceiver(
|
||||
config_.rtp.remote_ssrc, red_payload_type_, payload_type,
|
||||
config_.rtp.extensions, this, clock_);
|
||||
}
|
||||
|
||||
int RtpVideoStreamReceiver2::red_payload_type() const {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
return red_payload_type_;
|
||||
}
|
||||
|
||||
void RtpVideoStreamReceiver2::set_red_payload_type(int payload_type) {
|
||||
void RtpVideoStreamReceiver2::SetProtectionPayloadTypes(
|
||||
int red_payload_type,
|
||||
int ulpfec_payload_type) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
RTC_DCHECK_GE(payload_type, -1);
|
||||
RTC_DCHECK_LE(payload_type, 0x7f);
|
||||
// TODO(tommi, brandtr): It would be less error prone to require both
|
||||
// red and ulpfec payload ids to be set at the same time.
|
||||
|
||||
// Stash away the currently configured ulpfec payload id to carry over to the
|
||||
// potentially new `ulpfec_receiver_` instance.
|
||||
int ulpfec_type = ulpfec_payload_type();
|
||||
red_payload_type_ = payload_type;
|
||||
RTC_DCHECK(red_payload_type >= -1 && red_payload_type < 0x80);
|
||||
RTC_DCHECK(ulpfec_payload_type >= -1 && ulpfec_payload_type < 0x80);
|
||||
ulpfec_receiver_ = MaybeConstructUlpfecReceiver(
|
||||
config_.rtp.remote_ssrc, red_payload_type_, ulpfec_type,
|
||||
config_.rtp.remote_ssrc, red_payload_type, ulpfec_payload_type,
|
||||
config_.rtp.extensions, this, clock_);
|
||||
}
|
||||
|
||||
|
|
|
@ -201,10 +201,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
|
|||
void SetNackHistory(TimeDelta history);
|
||||
|
||||
int ulpfec_payload_type() const;
|
||||
void set_ulpfec_payload_type(int payload_type);
|
||||
|
||||
int red_payload_type() const;
|
||||
void set_red_payload_type(int payload_type);
|
||||
void SetProtectionPayloadTypes(int red_payload_type, int ulpfec_payload_type);
|
||||
|
||||
absl::optional<int64_t> LastReceivedPacketMs() const;
|
||||
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
|
||||
|
|
|
@ -551,14 +551,11 @@ void VideoReceiveStream2::SetNackHistory(TimeDelta history) {
|
|||
frame_buffer_->SetMaxWaits(max_wait_for_keyframe, max_wait_for_frame);
|
||||
}
|
||||
|
||||
void VideoReceiveStream2::SetUlpfecPayloadType(int payload_type) {
|
||||
void VideoReceiveStream2::SetProtectionPayloadTypes(int red_payload_type,
|
||||
int ulpfec_payload_type) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
rtp_video_stream_receiver_.set_ulpfec_payload_type(payload_type);
|
||||
}
|
||||
|
||||
void VideoReceiveStream2::SetRedPayloadType(int payload_type) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
rtp_video_stream_receiver_.set_red_payload_type(payload_type);
|
||||
rtp_video_stream_receiver_.SetProtectionPayloadTypes(red_payload_type,
|
||||
ulpfec_payload_type);
|
||||
}
|
||||
|
||||
void VideoReceiveStream2::SetRtcpXr(Config::Rtp::RtcpXr rtcp_xr) {
|
||||
|
|
|
@ -151,8 +151,8 @@ class VideoReceiveStream2
|
|||
void SetFlexFecProtection(RtpPacketSinkInterface* flexfec_sink) override;
|
||||
void SetLossNotificationEnabled(bool enabled) override;
|
||||
void SetNackHistory(TimeDelta history) override;
|
||||
void SetUlpfecPayloadType(int payload_type) override;
|
||||
void SetRedPayloadType(int payload_type) override;
|
||||
void SetProtectionPayloadTypes(int red_payload_type,
|
||||
int ulpfec_payload_type) override;
|
||||
void SetRtcpXr(Config::Rtp::RtcpXr rtcp_xr) override;
|
||||
|
||||
webrtc::VideoReceiveStreamInterface::Stats GetStats() const override;
|
||||
|
|
Loading…
Reference in a new issue