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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 const std::vector<VideoCodec>& recv_codecs, | 138 const std::vector<VideoCodec>& recv_codecs, |
139 WebRtcVideoEncoderFactory* external_encoder_factory, | 139 WebRtcVideoEncoderFactory* external_encoder_factory, |
140 WebRtcVideoDecoderFactory* external_decoder_factory); | 140 WebRtcVideoDecoderFactory* external_decoder_factory); |
141 ~WebRtcVideoChannel2() override; | 141 ~WebRtcVideoChannel2() override; |
142 | 142 |
143 // VideoMediaChannel implementation | 143 // VideoMediaChannel implementation |
144 rtc::DiffServCodePoint PreferredDscp() const override; | 144 rtc::DiffServCodePoint PreferredDscp() const override; |
145 | 145 |
146 bool SetSendParameters(const VideoSendParameters& params) override; | 146 bool SetSendParameters(const VideoSendParameters& params) override; |
147 bool SetRecvParameters(const VideoRecvParameters& params) override; | 147 bool SetRecvParameters(const VideoRecvParameters& params) override; |
| 148 webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const override; |
| 149 bool SetRtpParameters(uint32_t ssrc, |
| 150 const webrtc::RtpParameters& parameters) override; |
148 bool GetSendCodec(VideoCodec* send_codec) override; | 151 bool GetSendCodec(VideoCodec* send_codec) override; |
149 bool SetSend(bool send) override; | 152 bool SetSend(bool send) override; |
150 bool SetVideoSend(uint32_t ssrc, | 153 bool SetVideoSend(uint32_t ssrc, |
151 bool mute, | 154 bool mute, |
152 const VideoOptions* options) override; | 155 const VideoOptions* options) override; |
153 bool AddSendStream(const StreamParams& sp) override; | 156 bool AddSendStream(const StreamParams& sp) override; |
154 bool RemoveSendStream(uint32_t ssrc) override; | 157 bool RemoveSendStream(uint32_t ssrc) override; |
155 bool AddRecvStream(const StreamParams& sp) override; | 158 bool AddRecvStream(const StreamParams& sp) override; |
156 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 159 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
157 bool RemoveRecvStream(uint32_t ssrc) override; | 160 bool RemoveRecvStream(uint32_t ssrc) override; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bool enable_cpu_overuse_detection, | 241 bool enable_cpu_overuse_detection, |
239 int max_bitrate_bps, | 242 int max_bitrate_bps, |
240 const rtc::Optional<VideoCodecSettings>& codec_settings, | 243 const rtc::Optional<VideoCodecSettings>& codec_settings, |
241 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 244 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
242 const VideoSendParameters& send_params); | 245 const VideoSendParameters& send_params); |
243 virtual ~WebRtcVideoSendStream(); | 246 virtual ~WebRtcVideoSendStream(); |
244 | 247 |
245 void SetOptions(const VideoOptions& options); | 248 void SetOptions(const VideoOptions& options); |
246 // TODO(pbos): Move logic from SetOptions into this method. | 249 // TODO(pbos): Move logic from SetOptions into this method. |
247 void SetSendParameters(const ChangedSendParameters& send_params); | 250 void SetSendParameters(const ChangedSendParameters& send_params); |
| 251 bool SetRtpParameters(const webrtc::RtpParameters& parameters); |
248 | 252 |
249 void OnFrame(const cricket::VideoFrame& frame) override; | 253 void OnFrame(const cricket::VideoFrame& frame) override; |
250 bool SetCapturer(VideoCapturer* capturer); | 254 bool SetCapturer(VideoCapturer* capturer); |
251 void MuteStream(bool mute); | 255 void MuteStream(bool mute); |
252 bool DisconnectCapturer(); | 256 bool DisconnectCapturer(); |
253 | 257 |
254 void Start(); | 258 void Start(); |
255 void Stop(); | 259 void Stop(); |
256 | 260 |
| 261 webrtc::RtpParameters rtp_parameters() const { return rtp_parameters_; } |
| 262 |
257 // Implements webrtc::LoadObserver. | 263 // Implements webrtc::LoadObserver. |
258 void OnLoadUpdate(Load load) override; | 264 void OnLoadUpdate(Load load) override; |
259 | 265 |
260 const std::vector<uint32_t>& GetSsrcs() const; | 266 const std::vector<uint32_t>& GetSsrcs() const; |
261 VideoSenderInfo GetVideoSenderInfo(); | 267 VideoSenderInfo GetVideoSenderInfo(); |
262 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 268 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
263 | 269 |
264 private: | 270 private: |
265 // Parameters needed to reconstruct the underlying stream. | 271 // Parameters needed to reconstruct the underlying stream. |
266 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 272 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void DestroyVideoEncoder(AllocatedEncoder* encoder) | 337 void DestroyVideoEncoder(AllocatedEncoder* encoder) |
332 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 338 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
333 void SetCodec(const VideoCodecSettings& codec) | 339 void SetCodec(const VideoCodecSettings& codec) |
334 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 340 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
335 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); | 341 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); |
336 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( | 342 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( |
337 const Dimensions& dimensions, | 343 const Dimensions& dimensions, |
338 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); | 344 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); |
339 void SetDimensions(int width, int height) | 345 void SetDimensions(int width, int height) |
340 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 346 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
| 347 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); |
341 | 348 |
342 rtc::ThreadChecker thread_checker_; | 349 rtc::ThreadChecker thread_checker_; |
343 rtc::AsyncInvoker invoker_; | 350 rtc::AsyncInvoker invoker_; |
344 rtc::Thread* worker_thread_; | 351 rtc::Thread* worker_thread_; |
345 const std::vector<uint32_t> ssrcs_; | 352 const std::vector<uint32_t> ssrcs_; |
346 const std::vector<SsrcGroup> ssrc_groups_; | 353 const std::vector<SsrcGroup> ssrc_groups_; |
347 webrtc::Call* const call_; | 354 webrtc::Call* const call_; |
348 rtc::VideoSinkWants sink_wants_; | 355 rtc::VideoSinkWants sink_wants_; |
349 // Counter used for deciding if the video resolution is currently | 356 // Counter used for deciding if the video resolution is currently |
350 // restricted by CPU usage. It is reset if |capturer_| is changed. | 357 // restricted by CPU usage. It is reset if |capturer_| is changed. |
351 int cpu_restricted_counter_; | 358 int cpu_restricted_counter_; |
352 // Total number of times resolution as been requested to be changed due to | 359 // Total number of times resolution as been requested to be changed due to |
353 // CPU adaptation. | 360 // CPU adaptation. |
354 int number_of_cpu_adapt_changes_; | 361 int number_of_cpu_adapt_changes_; |
355 VideoCapturer* capturer_; | 362 VideoCapturer* capturer_; |
356 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 363 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
357 GUARDED_BY(lock_); | 364 GUARDED_BY(lock_); |
358 | 365 |
359 rtc::CriticalSection lock_; | 366 rtc::CriticalSection lock_; |
360 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 367 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
| 368 // Contains settings that are the same for all streams in the MediaChannel, |
| 369 // such as codecs, header extensions, and the global bitrate limit for the |
| 370 // entire channel. |
361 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 371 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
| 372 // Contains settings that are unique for each stream, such as max_bitrate. |
| 373 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
| 374 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
| 375 // one stream per MediaChannel. |
| 376 webrtc::RtpParameters rtp_parameters_; |
362 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); | 377 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); |
363 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 378 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
364 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 379 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
365 Dimensions last_dimensions_ GUARDED_BY(lock_); | 380 Dimensions last_dimensions_ GUARDED_BY(lock_); |
366 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = | 381 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = |
367 webrtc::kVideoRotation_0; | 382 webrtc::kVideoRotation_0; |
368 | 383 |
369 bool sending_ GUARDED_BY(lock_); | 384 bool sending_ GUARDED_BY(lock_); |
370 bool muted_ GUARDED_BY(lock_); | 385 bool muted_ GUARDED_BY(lock_); |
371 | 386 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // TODO(deadbeef): Don't duplicate information between | 531 // TODO(deadbeef): Don't duplicate information between |
517 // send_params/recv_params, rtp_extensions, options, etc. | 532 // send_params/recv_params, rtp_extensions, options, etc. |
518 VideoSendParameters send_params_; | 533 VideoSendParameters send_params_; |
519 VideoOptions default_send_options_; | 534 VideoOptions default_send_options_; |
520 VideoRecvParameters recv_params_; | 535 VideoRecvParameters recv_params_; |
521 }; | 536 }; |
522 | 537 |
523 } // namespace cricket | 538 } // namespace cricket |
524 | 539 |
525 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 540 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |