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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 void SetOptions(const VideoOptions& options); | 247 void SetOptions(const VideoOptions& options); |
248 // TODO(pbos): Move logic from SetOptions into this method. | 248 // TODO(pbos): Move logic from SetOptions into this method. |
249 void SetSendParameters(const ChangedSendParameters& send_params); | 249 void SetSendParameters(const ChangedSendParameters& send_params); |
250 bool SetRtpParameters(const webrtc::RtpParameters& parameters); | 250 bool SetRtpParameters(const webrtc::RtpParameters& parameters); |
251 | 251 |
252 void OnFrame(const cricket::VideoFrame& frame) override; | 252 void OnFrame(const cricket::VideoFrame& frame) override; |
253 bool SetCapturer(VideoCapturer* capturer); | 253 bool SetCapturer(VideoCapturer* capturer); |
254 void MuteStream(bool mute); | 254 void MuteStream(bool mute); |
255 bool DisconnectCapturer(); | 255 bool DisconnectCapturer(); |
256 | 256 |
257 void Start(); | 257 void SetSend(bool send); |
258 void Stop(); | |
259 | 258 |
260 webrtc::RtpParameters rtp_parameters() const { return rtp_parameters_; } | 259 webrtc::RtpParameters rtp_parameters() const { |
260 rtc::CritScope cs(&lock_); | |
pbos-webrtc
2016/03/22 18:13:43
This became non-trivial, move to .cc file.
Taylor Brandstetter
2016/03/22 18:32:43
Done.
| |
261 return rtp_parameters_; | |
262 } | |
261 | 263 |
262 // Implements webrtc::LoadObserver. | 264 // Implements webrtc::LoadObserver. |
263 void OnLoadUpdate(Load load) override; | 265 void OnLoadUpdate(Load load) override; |
264 | 266 |
265 const std::vector<uint32_t>& GetSsrcs() const; | 267 const std::vector<uint32_t>& GetSsrcs() const; |
266 VideoSenderInfo GetVideoSenderInfo(); | 268 VideoSenderInfo GetVideoSenderInfo(); |
267 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 269 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
268 | 270 |
269 private: | 271 private: |
272 // Calls Start or Stop according to whether or not |sending_| is true, | |
273 // and whether or not the encoding in |rtp_parameters_| is active. | |
274 void UpdateSendState(); | |
pbos-webrtc
2016/03/22 18:13:43
put EXCLUSIVE_LOCKS_REQUIRED(lock_) before ; to ha
Taylor Brandstetter
2016/03/22 18:32:43
Somehow I didn't notice the other methods and that
| |
275 | |
270 // Parameters needed to reconstruct the underlying stream. | 276 // Parameters needed to reconstruct the underlying stream. |
271 // webrtc::VideoSendStream doesn't support setting a lot of options on the | 277 // webrtc::VideoSendStream doesn't support setting a lot of options on the |
272 // fly, so when those need to be changed we tear down and reconstruct with | 278 // fly, so when those need to be changed we tear down and reconstruct with |
273 // similar parameters depending on which options changed etc. | 279 // similar parameters depending on which options changed etc. |
274 struct VideoSendStreamParameters { | 280 struct VideoSendStreamParameters { |
275 VideoSendStreamParameters( | 281 VideoSendStreamParameters( |
276 const webrtc::VideoSendStream::Config& config, | 282 const webrtc::VideoSendStream::Config& config, |
277 const VideoOptions& options, | 283 const VideoOptions& options, |
278 int max_bitrate_bps, | 284 int max_bitrate_bps, |
279 const rtc::Optional<VideoCodecSettings>& codec_settings); | 285 const rtc::Optional<VideoCodecSettings>& codec_settings); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 rtc::CriticalSection lock_; | 371 rtc::CriticalSection lock_; |
366 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 372 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
367 // Contains settings that are the same for all streams in the MediaChannel, | 373 // Contains settings that are the same for all streams in the MediaChannel, |
368 // such as codecs, header extensions, and the global bitrate limit for the | 374 // such as codecs, header extensions, and the global bitrate limit for the |
369 // entire channel. | 375 // entire channel. |
370 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 376 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
371 // Contains settings that are unique for each stream, such as max_bitrate. | 377 // Contains settings that are unique for each stream, such as max_bitrate. |
372 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 378 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
373 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 379 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
374 // one stream per MediaChannel. | 380 // one stream per MediaChannel. |
375 webrtc::RtpParameters rtp_parameters_; | 381 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); |
376 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); | 382 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); |
377 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 383 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
378 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 384 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
379 Dimensions last_dimensions_ GUARDED_BY(lock_); | 385 Dimensions last_dimensions_ GUARDED_BY(lock_); |
380 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = | 386 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = |
381 webrtc::kVideoRotation_0; | 387 webrtc::kVideoRotation_0; |
382 | 388 |
383 bool sending_ GUARDED_BY(lock_); | 389 bool sending_ GUARDED_BY(lock_); |
384 bool muted_ GUARDED_BY(lock_); | 390 bool muted_ GUARDED_BY(lock_); |
385 | 391 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); | 481 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); |
476 }; | 482 }; |
477 | 483 |
478 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); | 484 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); |
479 | 485 |
480 bool SendRtp(const uint8_t* data, | 486 bool SendRtp(const uint8_t* data, |
481 size_t len, | 487 size_t len, |
482 const webrtc::PacketOptions& options) override; | 488 const webrtc::PacketOptions& options) override; |
483 bool SendRtcp(const uint8_t* data, size_t len) override; | 489 bool SendRtcp(const uint8_t* data, size_t len) override; |
484 | 490 |
485 void StartAllSendStreams(); | |
486 void StopAllSendStreams(); | |
487 | |
488 static std::vector<VideoCodecSettings> MapCodecs( | 491 static std::vector<VideoCodecSettings> MapCodecs( |
489 const std::vector<VideoCodec>& codecs); | 492 const std::vector<VideoCodec>& codecs); |
490 std::vector<VideoCodecSettings> FilterSupportedCodecs( | 493 std::vector<VideoCodecSettings> FilterSupportedCodecs( |
491 const std::vector<VideoCodecSettings>& mapped_codecs) const; | 494 const std::vector<VideoCodecSettings>& mapped_codecs) const; |
492 static bool ReceiveCodecsHaveChanged(std::vector<VideoCodecSettings> before, | 495 static bool ReceiveCodecsHaveChanged(std::vector<VideoCodecSettings> before, |
493 std::vector<VideoCodecSettings> after); | 496 std::vector<VideoCodecSettings> after); |
494 | 497 |
495 void FillSenderStats(VideoMediaInfo* info); | 498 void FillSenderStats(VideoMediaInfo* info); |
496 void FillReceiverStats(VideoMediaInfo* info); | 499 void FillReceiverStats(VideoMediaInfo* info); |
497 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats, | 500 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 // TODO(deadbeef): Don't duplicate information between | 533 // TODO(deadbeef): Don't duplicate information between |
531 // send_params/recv_params, rtp_extensions, options, etc. | 534 // send_params/recv_params, rtp_extensions, options, etc. |
532 VideoSendParameters send_params_; | 535 VideoSendParameters send_params_; |
533 VideoOptions default_send_options_; | 536 VideoOptions default_send_options_; |
534 VideoRecvParameters recv_params_; | 537 VideoRecvParameters recv_params_; |
535 }; | 538 }; |
536 | 539 |
537 } // namespace cricket | 540 } // namespace cricket |
538 | 541 |
539 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 542 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |