OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 std::vector<VideoCodec> video_codecs_; | 123 std::vector<VideoCodec> video_codecs_; |
124 | 124 |
125 bool initialized_; | 125 bool initialized_; |
126 | 126 |
127 WebRtcVideoDecoderFactory* external_decoder_factory_; | 127 WebRtcVideoDecoderFactory* external_decoder_factory_; |
128 WebRtcVideoEncoderFactory* external_encoder_factory_; | 128 WebRtcVideoEncoderFactory* external_encoder_factory_; |
129 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; | 129 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; |
130 }; | 130 }; |
131 | 131 |
132 class WebRtcVideoChannel2 : public VideoMediaChannel, | 132 class WebRtcVideoChannel2 : public VideoMediaChannel, |
133 public webrtc::Transport, | 133 public webrtc::Transport { |
134 public webrtc::LoadObserver { | |
135 public: | 134 public: |
136 WebRtcVideoChannel2(webrtc::Call* call, | 135 WebRtcVideoChannel2(webrtc::Call* call, |
137 const MediaConfig& config, | 136 const MediaConfig& config, |
138 const VideoOptions& options, | 137 const VideoOptions& options, |
139 const std::vector<VideoCodec>& recv_codecs, | 138 const std::vector<VideoCodec>& recv_codecs, |
140 WebRtcVideoEncoderFactory* external_encoder_factory, | 139 WebRtcVideoEncoderFactory* external_encoder_factory, |
141 WebRtcVideoDecoderFactory* external_decoder_factory); | 140 WebRtcVideoDecoderFactory* external_decoder_factory); |
142 ~WebRtcVideoChannel2() override; | 141 ~WebRtcVideoChannel2() override; |
143 | 142 |
144 // VideoMediaChannel implementation | 143 // VideoMediaChannel implementation |
(...skipping 16 matching lines...) Expand all Loading... |
161 bool GetStats(VideoMediaInfo* info) override; | 160 bool GetStats(VideoMediaInfo* info) override; |
162 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; | 161 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; |
163 | 162 |
164 void OnPacketReceived(rtc::Buffer* packet, | 163 void OnPacketReceived(rtc::Buffer* packet, |
165 const rtc::PacketTime& packet_time) override; | 164 const rtc::PacketTime& packet_time) override; |
166 void OnRtcpReceived(rtc::Buffer* packet, | 165 void OnRtcpReceived(rtc::Buffer* packet, |
167 const rtc::PacketTime& packet_time) override; | 166 const rtc::PacketTime& packet_time) override; |
168 void OnReadyToSend(bool ready) override; | 167 void OnReadyToSend(bool ready) override; |
169 void SetInterface(NetworkInterface* iface) override; | 168 void SetInterface(NetworkInterface* iface) override; |
170 | 169 |
171 void OnLoadUpdate(Load load) override; | |
172 | |
173 // Implemented for VideoMediaChannelTest. | 170 // Implemented for VideoMediaChannelTest. |
174 bool sending() const { return sending_; } | 171 bool sending() const { return sending_; } |
175 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 172 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
176 | 173 |
177 private: | 174 private: |
178 class WebRtcVideoReceiveStream; | 175 class WebRtcVideoReceiveStream; |
179 struct VideoCodecSettings { | 176 struct VideoCodecSettings { |
180 VideoCodecSettings(); | 177 VideoCodecSettings(); |
181 | 178 |
182 bool operator==(const VideoCodecSettings& other) const; | 179 bool operator==(const VideoCodecSettings& other) const; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 219 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
223 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 220 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
224 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 221 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
225 | 222 |
226 static std::string CodecSettingsVectorToString( | 223 static std::string CodecSettingsVectorToString( |
227 const std::vector<VideoCodecSettings>& codecs); | 224 const std::vector<VideoCodecSettings>& codecs); |
228 | 225 |
229 // Wrapper for the sender part, this is where the capturer is connected and | 226 // Wrapper for the sender part, this is where the capturer is connected and |
230 // frames are then converted from cricket frames to webrtc frames. | 227 // frames are then converted from cricket frames to webrtc frames. |
231 class WebRtcVideoSendStream | 228 class WebRtcVideoSendStream |
232 : public rtc::VideoSinkInterface<cricket::VideoFrame> { | 229 : public rtc::VideoSinkInterface<cricket::VideoFrame>, |
| 230 public webrtc::LoadObserver { |
233 public: | 231 public: |
234 WebRtcVideoSendStream( | 232 WebRtcVideoSendStream( |
235 webrtc::Call* call, | 233 webrtc::Call* call, |
236 const StreamParams& sp, | 234 const StreamParams& sp, |
237 const webrtc::VideoSendStream::Config& config, | 235 const webrtc::VideoSendStream::Config& config, |
238 WebRtcVideoEncoderFactory* external_encoder_factory, | 236 WebRtcVideoEncoderFactory* external_encoder_factory, |
239 const VideoOptions& options, | 237 const VideoOptions& options, |
| 238 bool enable_cpu_overuse_detection, |
240 int max_bitrate_bps, | 239 int max_bitrate_bps, |
241 const rtc::Optional<VideoCodecSettings>& codec_settings, | 240 const rtc::Optional<VideoCodecSettings>& codec_settings, |
242 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 241 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
243 const VideoSendParameters& send_params); | 242 const VideoSendParameters& send_params); |
244 virtual ~WebRtcVideoSendStream(); | 243 virtual ~WebRtcVideoSendStream(); |
245 | 244 |
246 void SetOptions(const VideoOptions& options); | 245 void SetOptions(const VideoOptions& options); |
247 // TODO(pbos): Move logic from SetOptions into this method. | 246 // TODO(pbos): Move logic from SetOptions into this method. |
248 void SetSendParameters(const ChangedSendParameters& send_params); | 247 void SetSendParameters(const ChangedSendParameters& send_params); |
249 | 248 |
250 void OnFrame(const cricket::VideoFrame& frame) override; | 249 void OnFrame(const cricket::VideoFrame& frame) override; |
251 bool SetCapturer(VideoCapturer* capturer); | 250 bool SetCapturer(VideoCapturer* capturer); |
252 void MuteStream(bool mute); | 251 void MuteStream(bool mute); |
253 bool DisconnectCapturer(); | 252 bool DisconnectCapturer(); |
254 | 253 |
255 void Start(); | 254 void Start(); |
256 void Stop(); | 255 void Stop(); |
257 | 256 |
| 257 // Implements webrtc::LoadObserver. |
| 258 void OnLoadUpdate(Load load) override; |
| 259 |
258 const std::vector<uint32_t>& GetSsrcs() const; | 260 const std::vector<uint32_t>& GetSsrcs() const; |
259 VideoSenderInfo GetVideoSenderInfo(); | 261 VideoSenderInfo GetVideoSenderInfo(); |
260 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 262 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
261 | 263 |
262 private: | 264 private: |
263 // Parameters needed to reconstruct the underlying stream. | 265 // Parameters needed to reconstruct the underlying stream. |
264 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 266 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
265 // fly, so when those need to be changed we tear down and reconstruct with | 267 // fly, so when those need to be changed we tear down and reconstruct with |
266 // similar parameters depending on which options changed etc. | 268 // similar parameters depending on which options changed etc. |
267 struct VideoSendStreamParameters { | 269 struct VideoSendStreamParameters { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 VideoOptions options_; | 519 VideoOptions options_; |
518 // TODO(deadbeef): Don't duplicate information between | 520 // TODO(deadbeef): Don't duplicate information between |
519 // send_params/recv_params, rtp_extensions, options, etc. | 521 // send_params/recv_params, rtp_extensions, options, etc. |
520 VideoSendParameters send_params_; | 522 VideoSendParameters send_params_; |
521 VideoRecvParameters recv_params_; | 523 VideoRecvParameters recv_params_; |
522 }; | 524 }; |
523 | 525 |
524 } // namespace cricket | 526 } // namespace cricket |
525 | 527 |
526 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 528 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |