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>, | |
247 public webrtc::LoadObserver { | 246 public webrtc::LoadObserver { |
248 public: | 247 public: |
249 WebRtcVideoSendStream( | 248 WebRtcVideoSendStream( |
250 webrtc::Call* call, | 249 webrtc::Call* call, |
251 const StreamParams& sp, | 250 const StreamParams& sp, |
252 webrtc::VideoSendStream::Config config, | 251 webrtc::VideoSendStream::Config config, |
253 const VideoOptions& options, | 252 const VideoOptions& options, |
254 WebRtcVideoEncoderFactory* external_encoder_factory, | 253 WebRtcVideoEncoderFactory* external_encoder_factory, |
255 bool enable_cpu_overuse_detection, | 254 bool enable_cpu_overuse_detection, |
256 int max_bitrate_bps, | 255 int max_bitrate_bps, |
257 const rtc::Optional<VideoCodecSettings>& codec_settings, | 256 const rtc::Optional<VideoCodecSettings>& codec_settings, |
258 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions, | 257 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions, |
259 const VideoSendParameters& send_params); | 258 const VideoSendParameters& send_params); |
260 virtual ~WebRtcVideoSendStream(); | 259 virtual ~WebRtcVideoSendStream(); |
261 | 260 |
262 void SetSendParameters(const ChangedSendParameters& send_params); | 261 void SetSendParameters(const ChangedSendParameters& send_params); |
263 bool SetRtpParameters(const webrtc::RtpParameters& parameters); | 262 bool SetRtpParameters(const webrtc::RtpParameters& parameters); |
264 webrtc::RtpParameters GetRtpParameters() const; | 263 webrtc::RtpParameters GetRtpParameters() const; |
265 | 264 |
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 | |
276 void OnFrame(const cricket::VideoFrame& frame) override; | 265 void OnFrame(const cricket::VideoFrame& frame) override; |
277 bool SetVideoSend(bool mute, | 266 bool SetVideoSend(bool mute, |
278 const VideoOptions* options, | 267 const VideoOptions* options, |
279 rtc::VideoSourceInterface<cricket::VideoFrame>* source); | 268 rtc::VideoSourceInterface<cricket::VideoFrame>* source); |
280 void DisconnectSource(); | 269 void DisconnectSource(); |
281 | 270 |
282 void SetSend(bool send); | 271 void SetSend(bool send); |
283 | 272 |
284 // Implements webrtc::LoadObserver. | 273 // Implements webrtc::LoadObserver. |
285 void OnLoadUpdate(Load load) override; | 274 void OnLoadUpdate(Load load) override; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // Total number of frames sent to |stream_|. | 382 // Total number of frames sent to |stream_|. |
394 int frame_count_ GUARDED_BY(lock_); | 383 int frame_count_ GUARDED_BY(lock_); |
395 // Total number of cpu restricted frames sent to |stream_|. | 384 // Total number of cpu restricted frames sent to |stream_|. |
396 int cpu_restricted_frame_count_ GUARDED_BY(lock_); | 385 int cpu_restricted_frame_count_ GUARDED_BY(lock_); |
397 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; | 386 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; |
398 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 387 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
399 GUARDED_BY(lock_); | 388 GUARDED_BY(lock_); |
400 | 389 |
401 rtc::CriticalSection lock_; | 390 rtc::CriticalSection lock_; |
402 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 391 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
403 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ | |
404 GUARDED_BY(lock_); | |
405 // Contains settings that are the same for all streams in the MediaChannel, | 392 // Contains settings that are the same for all streams in the MediaChannel, |
406 // such as codecs, header extensions, and the global bitrate limit for the | 393 // such as codecs, header extensions, and the global bitrate limit for the |
407 // entire channel. | 394 // entire channel. |
408 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 395 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
409 // Contains settings that are unique for each stream, such as max_bitrate. | 396 // Contains settings that are unique for each stream, such as max_bitrate. |
410 // Does *not* contain codecs, however. | 397 // Does *not* contain codecs, however. |
411 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 398 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
412 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 399 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
413 // one stream per MediaChannel. | 400 // one stream per MediaChannel. |
414 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); | 401 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 VideoSendParameters send_params_; | 552 VideoSendParameters send_params_; |
566 VideoOptions default_send_options_; | 553 VideoOptions default_send_options_; |
567 VideoRecvParameters recv_params_; | 554 VideoRecvParameters recv_params_; |
568 bool red_disabled_by_remote_side_; | 555 bool red_disabled_by_remote_side_; |
569 int64_t last_stats_log_ms_; | 556 int64_t last_stats_log_ms_; |
570 }; | 557 }; |
571 | 558 |
572 } // namespace cricket | 559 } // namespace cricket |
573 | 560 |
574 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 561 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |