Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: webrtc/media/base/mediachannel.h

Issue 1646253004: Split out dscp option from VideoOptions to new struct MediaChannelOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/mediaengine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/mediachannel.h
diff --git a/webrtc/media/base/mediachannel.h b/webrtc/media/base/mediachannel.h
index 30d4a45ff21debbf7caa4ba80b17873046193bf4..170df586a7586a2cb8a3ffd3c5a01db8ba7f8eeb 100644
--- a/webrtc/media/base/mediachannel.h
+++ b/webrtc/media/base/mediachannel.h
@@ -95,6 +95,12 @@ static std::string VectorToString(const std::vector<T>& vals) {
return ost.str();
}
+struct MediaChannelOptions {
+ // Set DSCP value for packet sent from media channel. This flag
+ // comes from the PeerConnection constraint 'googDscp'.
+ bool enable_dscp = false;
+};
+
// Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine.
// Used to be flags, but that makes it hard to selectively apply options.
// We are moving all of the setting of options to structs like this,
@@ -125,7 +131,6 @@ struct AudioOptions {
SetFrom(&tx_agc_limiter, change.tx_agc_limiter);
SetFrom(&recording_sample_rate, change.recording_sample_rate);
SetFrom(&playout_sample_rate, change.playout_sample_rate);
- SetFrom(&dscp, change.dscp);
SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe);
}
@@ -152,7 +157,6 @@ struct AudioOptions {
tx_agc_limiter == o.tx_agc_limiter &&
recording_sample_rate == o.recording_sample_rate &&
playout_sample_rate == o.playout_sample_rate &&
- dscp == o.dscp &&
combined_audio_video_bwe == o.combined_audio_video_bwe;
}
@@ -183,7 +187,6 @@ struct AudioOptions {
ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter);
ost << ToStringIfSet("recording_sample_rate", recording_sample_rate);
ost << ToStringIfSet("playout_sample_rate", playout_sample_rate);
- ost << ToStringIfSet("dscp", dscp);
ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe);
ost << "}";
return ost.str();
@@ -220,8 +223,6 @@ struct AudioOptions {
rtc::Optional<bool> tx_agc_limiter;
rtc::Optional<uint32_t> recording_sample_rate;
rtc::Optional<uint32_t> playout_sample_rate;
- // Set DSCP value for packet sent from audio channel.
- rtc::Optional<bool> dscp;
// Enable combined audio+bandwidth BWE.
rtc::Optional<bool> combined_audio_video_bwe;
@@ -243,7 +244,6 @@ struct VideoOptions {
SetFrom(&video_noise_reduction, change.video_noise_reduction);
SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection);
SetFrom(&conference_mode, change.conference_mode);
- SetFrom(&dscp, change.dscp);
SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate);
SetFrom(&screencast_min_bitrate_kbps, change.screencast_min_bitrate_kbps);
SetFrom(&disable_prerenderer_smoothing,
@@ -254,7 +254,6 @@ struct VideoOptions {
return video_noise_reduction == o.video_noise_reduction &&
cpu_overuse_detection == o.cpu_overuse_detection &&
conference_mode == o.conference_mode &&
- dscp == o.dscp &&
suspend_below_min_bitrate == o.suspend_below_min_bitrate &&
screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps &&
disable_prerenderer_smoothing == o.disable_prerenderer_smoothing;
@@ -266,7 +265,6 @@ struct VideoOptions {
ost << ToStringIfSet("noise reduction", video_noise_reduction);
ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection);
ost << ToStringIfSet("conference mode", conference_mode);
- ost << ToStringIfSet("dscp", dscp);
ost << ToStringIfSet("suspend below min bitrate",
suspend_below_min_bitrate);
ost << ToStringIfSet("screencast min bitrate kbps",
@@ -291,12 +289,6 @@ struct VideoOptions {
// WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig.
// The special screencast behaviour is disabled by default.
rtc::Optional<bool> conference_mode;
- // Set DSCP value for packet sent from video channel. This flag
- // comes from the PeerConnection constraint 'googDscp' and,
- // WebRtcVideoChannel2::SetOptions checks it before calling
- // MediaChannel::SetDscp. If enabled, rtc::DSCP_AF41 is used. If
- // disabled, which is the default, rtc::DSCP_DEFAULT is used.
- rtc::Optional<bool> dscp;
// Enable WebRTC suspension of video. No video frames will be sent
// when the bitrate is below the configured minimum bitrate. This
// flag comes from the PeerConnection constraint
@@ -385,13 +377,18 @@ class MediaChannel : public sigslot::has_slots<> {
virtual ~NetworkInterface() {}
};
- MediaChannel() : network_interface_(NULL) {}
+ MediaChannel(const MediaChannelOptions& options)
+ : options_(options), network_interface_(NULL) {}
virtual ~MediaChannel() {}
// Sets the abstract interface class for sending RTP/RTCP data.
virtual void SetInterface(NetworkInterface *iface) {
rtc::CritScope cs(&network_interface_crit_);
network_interface_ = iface;
+ SetDscp(options_.enable_dscp ? MediaTypeDscpValue() : rtc::DSCP_DEFAULT);
+ }
+ virtual rtc::DiffServCodePoint MediaTypeDscpValue() const {
+ return rtc::DSCP_DEFAULT;
}
// Called when a RTP packet is received.
@@ -468,6 +465,7 @@ class MediaChannel : public sigslot::has_slots<> {
: network_interface_->SendRtcp(packet, options);
}
+ const MediaChannelOptions options_;
// |network_interface_| can be accessed from the worker_thread and
// from any MediaEngine threads. This critical section is to protect accessing
// of network_interface_ object.
@@ -920,7 +918,9 @@ class VoiceMediaChannel : public MediaChannel {
ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
};
- VoiceMediaChannel() {}
+ VoiceMediaChannel(const MediaChannelOptions& options)
+ : MediaChannel(options) {}
+
virtual ~VoiceMediaChannel() {}
virtual bool SetSendParameters(const AudioSendParameters& params) = 0;
virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0;
@@ -983,7 +983,8 @@ class VideoMediaChannel : public MediaChannel {
ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
};
- VideoMediaChannel() {}
+ VideoMediaChannel(const MediaChannelOptions& options)
+ : MediaChannel(options) {}
virtual ~VideoMediaChannel() {}
virtual bool SetSendParameters(const VideoSendParameters& params) = 0;
@@ -1106,6 +1107,8 @@ class DataMediaChannel : public MediaChannel {
ERROR_RECV_SRTP_REPLAY, // Packet replay detected.
};
+ DataMediaChannel(const MediaChannelOptions& options)
+ : MediaChannel(options) {}
virtual ~DataMediaChannel() {}
virtual bool SetSendParameters(const DataSendParameters& params) = 0;
« no previous file with comments | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/mediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698