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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // Total number of frames sent to |stream_|. | 388 // Total number of frames sent to |stream_|. |
383 int frame_count_ GUARDED_BY(lock_); | 389 int frame_count_ GUARDED_BY(lock_); |
384 // Total number of cpu restricted frames sent to |stream_|. | 390 // Total number of cpu restricted frames sent to |stream_|. |
385 int cpu_restricted_frame_count_ GUARDED_BY(lock_); | 391 int cpu_restricted_frame_count_ GUARDED_BY(lock_); |
386 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; | 392 rtc::VideoSourceInterface<cricket::VideoFrame>* source_; |
387 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 393 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
388 GUARDED_BY(lock_); | 394 GUARDED_BY(lock_); |
389 | 395 |
390 rtc::CriticalSection lock_; | 396 rtc::CriticalSection lock_; |
391 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 397 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
| 398 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ |
| 399 GUARDED_BY(lock_); |
392 // Contains settings that are the same for all streams in the MediaChannel, | 400 // 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 | 401 // such as codecs, header extensions, and the global bitrate limit for the |
394 // entire channel. | 402 // entire channel. |
395 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 403 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
396 // Contains settings that are unique for each stream, such as max_bitrate. | 404 // Contains settings that are unique for each stream, such as max_bitrate. |
397 // Does *not* contain codecs, however. | 405 // Does *not* contain codecs, however. |
398 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 406 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
399 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 407 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
400 // one stream per MediaChannel. | 408 // one stream per MediaChannel. |
401 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); | 409 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 VideoSendParameters send_params_; | 564 VideoSendParameters send_params_; |
557 VideoOptions default_send_options_; | 565 VideoOptions default_send_options_; |
558 VideoRecvParameters recv_params_; | 566 VideoRecvParameters recv_params_; |
559 bool red_disabled_by_remote_side_; | 567 bool red_disabled_by_remote_side_; |
560 int64_t last_stats_log_ms_; | 568 int64_t last_stats_log_ms_; |
561 }; | 569 }; |
562 | 570 |
563 } // namespace cricket | 571 } // namespace cricket |
564 | 572 |
565 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 573 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |