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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 236 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
237 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 237 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
238 | 238 |
239 static std::string CodecSettingsVectorToString( | 239 static std::string CodecSettingsVectorToString( |
240 const std::vector<VideoCodecSettings>& codecs); | 240 const std::vector<VideoCodecSettings>& codecs); |
241 | 241 |
242 // Wrapper for the sender part, this is where the source is connected and | 242 // Wrapper for the sender part, this is where the source is connected and |
243 // frames are then converted from cricket frames to webrtc frames. | 243 // frames are then converted from cricket frames to webrtc frames. |
244 class WebRtcVideoSendStream | 244 class WebRtcVideoSendStream |
245 : public rtc::VideoSinkInterface<cricket::VideoFrame>, | 245 : public rtc::VideoSinkInterface<cricket::VideoFrame>, |
| 246 public rtc::VideoSourceInterface<webrtc::VideoFrame>, |
246 public webrtc::LoadObserver { | 247 public webrtc::LoadObserver { |
247 public: | 248 public: |
248 WebRtcVideoSendStream( | 249 WebRtcVideoSendStream( |
249 webrtc::Call* call, | 250 webrtc::Call* call, |
250 const StreamParams& sp, | 251 const StreamParams& sp, |
251 webrtc::VideoSendStream::Config config, | 252 webrtc::VideoSendStream::Config config, |
252 const VideoOptions& options, | 253 const VideoOptions& options, |
253 WebRtcVideoEncoderFactory* external_encoder_factory, | 254 WebRtcVideoEncoderFactory* external_encoder_factory, |
254 bool enable_cpu_overuse_detection, | 255 bool enable_cpu_overuse_detection, |
255 int max_bitrate_bps, | 256 int max_bitrate_bps, |
256 const rtc::Optional<VideoCodecSettings>& codec_settings, | 257 const rtc::Optional<VideoCodecSettings>& codec_settings, |
257 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions, | 258 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions, |
258 const VideoSendParameters& send_params); | 259 const VideoSendParameters& send_params); |
259 virtual ~WebRtcVideoSendStream(); | 260 virtual ~WebRtcVideoSendStream(); |
260 | 261 |
261 void SetSendParameters(const ChangedSendParameters& send_params); | 262 void SetSendParameters(const ChangedSendParameters& send_params); |
262 bool SetRtpParameters(const webrtc::RtpParameters& parameters); | 263 bool SetRtpParameters(const webrtc::RtpParameters& parameters); |
263 webrtc::RtpParameters GetRtpParameters() const; | 264 webrtc::RtpParameters GetRtpParameters() const; |
264 | 265 |
| 266 // Implements rtc::VideoSourceInterface<webrtc::VideoFrame> |
| 267 void AddOrUpdateSink(VideoSinkInterface<webrtc::VideoFrame>* sink, |
| 268 const rtc::VideoSinkWants& wants) override; |
| 269 void RemoveSink(VideoSinkInterface<webrtc::VideoFrame>* sink) override; |
| 270 |
265 void OnFrame(const cricket::VideoFrame& frame) override; | 271 void OnFrame(const cricket::VideoFrame& frame) override; |
266 bool SetVideoSend(bool mute, | 272 bool SetVideoSend(bool mute, |
267 const VideoOptions* options, | 273 const VideoOptions* options, |
268 rtc::VideoSourceInterface<cricket::VideoFrame>* source); | 274 rtc::VideoSourceInterface<cricket::VideoFrame>* source); |
269 void DisconnectSource(); | 275 void DisconnectSource(); |
270 | 276 |
271 void SetSend(bool send); | 277 void SetSend(bool send); |
272 | 278 |
273 // Implements webrtc::LoadObserver. | 279 // Implements webrtc::LoadObserver. |
274 void OnLoadUpdate(Load load) override; | 280 void OnLoadUpdate(Load load) override; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 int cpu_restricted_counter_; | 382 int cpu_restricted_counter_; |
377 // Total number of times resolution as been requested to be changed due to | 383 // Total number of times resolution as been requested to be changed due to |
378 // CPU adaptation. | 384 // CPU adaptation. |
379 int number_of_cpu_adapt_changes_; | 385 int number_of_cpu_adapt_changes_; |
380 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; | 386 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; |
381 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 387 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
382 GUARDED_BY(lock_); | 388 GUARDED_BY(lock_); |
383 | 389 |
384 rtc::CriticalSection lock_; | 390 rtc::CriticalSection lock_; |
385 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 391 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
| 392 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ |
| 393 GUARDED_BY(lock_); |
386 // Contains settings that are the same for all streams in the MediaChannel, | 394 // Contains settings that are the same for all streams in the MediaChannel, |
387 // such as codecs, header extensions, and the global bitrate limit for the | 395 // such as codecs, header extensions, and the global bitrate limit for the |
388 // entire channel. | 396 // entire channel. |
389 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 397 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
390 // Contains settings that are unique for each stream, such as max_bitrate. | 398 // Contains settings that are unique for each stream, such as max_bitrate. |
391 // Does *not* contain codecs, however. | 399 // Does *not* contain codecs, however. |
392 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 400 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
393 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 401 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
394 // one stream per MediaChannel. | 402 // one stream per MediaChannel. |
395 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); | 403 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 VideoSendParameters send_params_; | 560 VideoSendParameters send_params_; |
553 VideoOptions default_send_options_; | 561 VideoOptions default_send_options_; |
554 VideoRecvParameters recv_params_; | 562 VideoRecvParameters recv_params_; |
555 bool red_disabled_by_remote_side_; | 563 bool red_disabled_by_remote_side_; |
556 int64_t last_stats_log_ms_; | 564 int64_t last_stats_log_ms_; |
557 }; | 565 }; |
558 | 566 |
559 } // namespace cricket | 567 } // namespace cricket |
560 | 568 |
561 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 569 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |