Chromium Code Reviews| Index: webrtc/media/base/mediachannel.h |
| diff --git a/webrtc/media/base/mediachannel.h b/webrtc/media/base/mediachannel.h |
| index 30d4a45ff21debbf7caa4ba80b17873046193bf4..99cbac30568d22f37162033fed3d418fdfec6a79 100644 |
| --- a/webrtc/media/base/mediachannel.h |
| +++ b/webrtc/media/base/mediachannel.h |
| @@ -45,6 +45,8 @@ |
| #include "webrtc/media/base/videosinkinterface.h" |
| // TODO(juberti): re-evaluate this include |
| #include "talk/session/media/audiomonitor.h" |
| +// TODO(nisse): Improper include? Move declaration of MediaConfig elsewhere? |
| +#include "talk/app/webrtc/mediacontroller.h" |
|
pthatcher1
2016/02/05 17:11:30
We could put MediaConfig here in mediachannel.h or
nisse-webrtc
2016/02/08 09:02:32
mediachannel.h sounds reasonable to me. And then a
|
| namespace rtc { |
| class Buffer; |
| @@ -125,7 +127,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 +153,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 +183,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 +219,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; |
| @@ -241,32 +238,23 @@ struct AudioOptions { |
| struct VideoOptions { |
| void SetAll(const VideoOptions& change) { |
| 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, |
| - change.disable_prerenderer_smoothing); |
| } |
| bool operator==(const VideoOptions& o) const { |
| 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; |
| + screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps; |
| } |
| std::string ToString() const { |
| std::ostringstream ost; |
| ost << "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", |
| @@ -279,11 +267,6 @@ struct VideoOptions { |
| // constraint 'googNoiseReduction', and WebRtcVideoEngine2 passes it |
| // on to the codec options. Disabled by default. |
| rtc::Optional<bool> video_noise_reduction; |
| - // Enable WebRTC Cpu Overuse Detection. This flag comes from the |
| - // PeerConnection constraint 'googCpuOveruseDetection' and is |
| - // checked in WebRtcVideoChannel2::OnLoadUpdate, where it's passed |
| - // to VideoCapturer::video_adapter()->OnCpuResolutionRequest. |
| - rtc::Optional<bool> cpu_overuse_detection; |
| // Use conference mode? This flag comes from the remote |
| // description's SDP line 'a=x-google-flag:conference', copied over |
| // by VideoChannel::SetRemoteContent_w, and ultimately used by |
| @@ -291,12 +274,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 |
| @@ -307,22 +284,6 @@ struct VideoOptions { |
| // the PeerConnection constraint 'googScreencastMinBitrate'. It is |
| // copied to the encoder config by WebRtcVideoChannel2. |
| rtc::Optional<int> screencast_min_bitrate_kbps; |
| - // Set to true if the renderer has an algorithm of frame selection. |
| - // If the value is true, then WebRTC will hand over a frame as soon as |
| - // possible without delay, and rendering smoothness is completely the duty |
| - // of the renderer; |
| - // If the value is false, then WebRTC is responsible to delay frame release |
| - // in order to increase rendering smoothness. |
| - // |
| - // This flag comes from PeerConnection's RtcConfiguration, but is |
| - // currently only set by the command line flag |
| - // 'disable-rtc-smoothness-algorithm'. |
| - // WebRtcVideoChannel2::AddRecvStream copies it to the created |
| - // WebRtcVideoReceiveStream, where it is returned by the |
| - // SmoothsRenderedFrames method. This method is used by the |
| - // VideoReceiveStream, where the value is passed on to the |
| - // IncomingVideoStream constructor. |
| - rtc::Optional<bool> disable_prerenderer_smoothing; |
| private: |
| template <typename T> |
| @@ -385,15 +346,22 @@ class MediaChannel : public sigslot::has_slots<> { |
| virtual ~NetworkInterface() {} |
| }; |
| - MediaChannel() : network_interface_(NULL) {} |
| + MediaChannel(const webrtc::MediaConfig& config) |
| + : network_interface_(NULL) { |
| + enable_dscp_ = config.enable_dscp; |
| + } |
| + MediaChannel() : enable_dscp_(false), 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(enable_dscp_ ? MediaTypeDscpValue() : rtc::DSCP_DEFAULT); |
|
pthatcher1
2016/02/05 17:11:30
Can you call this something like preferred_dscp()
nisse-webrtc
2016/02/08 09:02:32
Sure. But for consistency, shouldn't the method na
pbos-webrtc
2016/02/08 10:38:48
https://google.github.io/styleguide/cppguide.html#
nisse-webrtc
2016/02/08 12:22:30
Ok. I used CamelCase for now, but I can change it
|
| + } |
| + virtual rtc::DiffServCodePoint MediaTypeDscpValue() const { |
| + return rtc::DSCP_DEFAULT; |
| } |
| - |
| // Called when a RTP packet is received. |
| virtual void OnPacketReceived(rtc::Buffer* packet, |
| const rtc::PacketTime& packet_time) = 0; |
| @@ -441,7 +409,7 @@ class MediaChannel : public sigslot::has_slots<> { |
| return network_interface_->SetOption(type, opt, option); |
| } |
| - protected: |
| + private: |
| // This method sets DSCP |value| on both RTP and RTCP channels. |
| int SetDscp(rtc::DiffServCodePoint value) { |
| int ret; |
| @@ -468,6 +436,7 @@ class MediaChannel : public sigslot::has_slots<> { |
| : network_interface_->SendRtcp(packet, options); |
| } |
| + bool enable_dscp_; |
| // |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. |
| @@ -921,6 +890,7 @@ class VoiceMediaChannel : public MediaChannel { |
| }; |
| VoiceMediaChannel() {} |
| + VoiceMediaChannel(const webrtc::MediaConfig& config) : MediaChannel(config) {} |
| virtual ~VoiceMediaChannel() {} |
| virtual bool SetSendParameters(const AudioSendParameters& params) = 0; |
| virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; |
| @@ -984,6 +954,7 @@ class VideoMediaChannel : public MediaChannel { |
| }; |
| VideoMediaChannel() {} |
| + VideoMediaChannel(const webrtc::MediaConfig& config) : MediaChannel(config) {} |
| virtual ~VideoMediaChannel() {} |
| virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |