| 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 // WebRtcVideoSendStream acts as a source to the webrtc::VideoSendStream |
| 268 // in |stream_|. The reason is that WebRtcVideoSendStream receives |
| 269 // cricket::VideoFrames and forwards webrtc::VideoFrames to |source_|. |
| 270 // TODO(perkj, nisse): Refactor WebRtcVideoSendStream to directly connect |
| 271 // the camera input |source_| |
| 272 void AddOrUpdateSink(VideoSinkInterface<webrtc::VideoFrame>* sink, |
| 273 const rtc::VideoSinkWants& wants) override; |
| 274 void RemoveSink(VideoSinkInterface<webrtc::VideoFrame>* sink) override; |
| 275 |
| 265 void OnFrame(const cricket::VideoFrame& frame) override; | 276 void OnFrame(const cricket::VideoFrame& frame) override; |
| 266 bool SetVideoSend(bool mute, | 277 bool SetVideoSend(bool mute, |
| 267 const VideoOptions* options, | 278 const VideoOptions* options, |
| 268 rtc::VideoSourceInterface<cricket::VideoFrame>* source); | 279 rtc::VideoSourceInterface<cricket::VideoFrame>* source); |
| 269 void DisconnectSource(); | 280 void DisconnectSource(); |
| 270 | 281 |
| 271 void SetSend(bool send); | 282 void SetSend(bool send); |
| 272 | 283 |
| 273 // Implements webrtc::LoadObserver. | 284 // Implements webrtc::LoadObserver. |
| 274 void OnLoadUpdate(Load load) override; | 285 void OnLoadUpdate(Load load) override; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // Total number of frames sent to |stream_|. | 393 // Total number of frames sent to |stream_|. |
| 383 int frame_count_ GUARDED_BY(lock_); | 394 int frame_count_ GUARDED_BY(lock_); |
| 384 // Total number of cpu restricted frames sent to |stream_|. | 395 // Total number of cpu restricted frames sent to |stream_|. |
| 385 int cpu_restricted_frame_count_ GUARDED_BY(lock_); | 396 int cpu_restricted_frame_count_ GUARDED_BY(lock_); |
| 386 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; | 397 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; |
| 387 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 398 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
| 388 GUARDED_BY(lock_); | 399 GUARDED_BY(lock_); |
| 389 | 400 |
| 390 rtc::CriticalSection lock_; | 401 rtc::CriticalSection lock_; |
| 391 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 402 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
| 403 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ |
| 404 GUARDED_BY(lock_); |
| 392 // Contains settings that are the same for all streams in the MediaChannel, | 405 // Contains settings that are the same for all streams in the MediaChannel, |
| 393 // such as codecs, header extensions, and the global bitrate limit for the | 406 // such as codecs, header extensions, and the global bitrate limit for the |
| 394 // entire channel. | 407 // entire channel. |
| 395 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 408 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
| 396 // Contains settings that are unique for each stream, such as max_bitrate. | 409 // Contains settings that are unique for each stream, such as max_bitrate. |
| 397 // Does *not* contain codecs, however. | 410 // Does *not* contain codecs, however. |
| 398 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 411 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
| 399 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 412 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
| 400 // one stream per MediaChannel. | 413 // one stream per MediaChannel. |
| 401 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); | 414 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 VideoSendParameters send_params_; | 565 VideoSendParameters send_params_; |
| 553 VideoOptions default_send_options_; | 566 VideoOptions default_send_options_; |
| 554 VideoRecvParameters recv_params_; | 567 VideoRecvParameters recv_params_; |
| 555 bool red_disabled_by_remote_side_; | 568 bool red_disabled_by_remote_side_; |
| 556 int64_t last_stats_log_ms_; | 569 int64_t last_stats_log_ms_; |
| 557 }; | 570 }; |
| 558 | 571 |
| 559 } // namespace cricket | 572 } // namespace cricket |
| 560 | 573 |
| 561 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 574 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
| OLD | NEW |