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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool GetChangedRecvParameters(const VideoRecvParameters& params, | 234 bool GetChangedRecvParameters(const VideoRecvParameters& params, |
235 ChangedRecvParameters* changed_params) const; | 235 ChangedRecvParameters* changed_params) const; |
236 | 236 |
237 void SetMaxSendBandwidth(int bps); | 237 void SetMaxSendBandwidth(int bps); |
238 | 238 |
239 void ConfigureReceiverRtp( | 239 void ConfigureReceiverRtp( |
240 webrtc::VideoReceiveStream::Config* config, | 240 webrtc::VideoReceiveStream::Config* config, |
241 webrtc::FlexfecReceiveStream::Config* flexfec_config, | 241 webrtc::FlexfecReceiveStream::Config* flexfec_config, |
242 const StreamParams& sp) const; | 242 const StreamParams& sp) const; |
243 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 243 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
244 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 244 RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
245 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 245 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
246 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 246 RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
247 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 247 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
248 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 248 RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
249 | 249 |
250 static std::string CodecSettingsVectorToString( | 250 static std::string CodecSettingsVectorToString( |
251 const std::vector<VideoCodecSettings>& codecs); | 251 const std::vector<VideoCodecSettings>& codecs); |
252 | 252 |
253 // Wrapper for the sender part. | 253 // Wrapper for the sender part. |
254 class WebRtcVideoSendStream | 254 class WebRtcVideoSendStream |
255 : public rtc::VideoSourceInterface<webrtc::VideoFrame> { | 255 : public rtc::VideoSourceInterface<webrtc::VideoFrame> { |
256 public: | 256 public: |
257 WebRtcVideoSendStream( | 257 WebRtcVideoSendStream( |
258 webrtc::Call* call, | 258 webrtc::Call* call, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( | 319 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( |
320 const VideoCodec& codec) const; | 320 const VideoCodec& codec) const; |
321 void ReconfigureEncoder(); | 321 void ReconfigureEncoder(); |
322 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); | 322 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); |
323 | 323 |
324 // Calls Start or Stop according to whether or not |sending_| is true, | 324 // Calls Start or Stop according to whether or not |sending_| is true, |
325 // and whether or not the encoding in |rtp_parameters_| is active. | 325 // and whether or not the encoding in |rtp_parameters_| is active. |
326 void UpdateSendState(); | 326 void UpdateSendState(); |
327 | 327 |
328 webrtc::VideoSendStream::DegradationPreference GetDegradationPreference() | 328 webrtc::VideoSendStream::DegradationPreference GetDegradationPreference() |
329 const EXCLUSIVE_LOCKS_REQUIRED(&thread_checker_); | 329 const RTC_EXCLUSIVE_LOCKS_REQUIRED(&thread_checker_); |
330 | 330 |
331 rtc::ThreadChecker thread_checker_; | 331 rtc::ThreadChecker thread_checker_; |
332 rtc::AsyncInvoker invoker_; | 332 rtc::AsyncInvoker invoker_; |
333 rtc::Thread* worker_thread_; | 333 rtc::Thread* worker_thread_; |
334 const std::vector<uint32_t> ssrcs_ ACCESS_ON(&thread_checker_); | 334 const std::vector<uint32_t> ssrcs_ RTC_ACCESS_ON(&thread_checker_); |
335 const std::vector<SsrcGroup> ssrc_groups_ ACCESS_ON(&thread_checker_); | 335 const std::vector<SsrcGroup> ssrc_groups_ RTC_ACCESS_ON(&thread_checker_); |
336 webrtc::Call* const call_; | 336 webrtc::Call* const call_; |
337 const bool enable_cpu_overuse_detection_; | 337 const bool enable_cpu_overuse_detection_; |
338 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_ | 338 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_ |
339 ACCESS_ON(&thread_checker_); | 339 RTC_ACCESS_ON(&thread_checker_); |
340 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_ | 340 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_ |
341 ACCESS_ON(&thread_checker_); | 341 RTC_ACCESS_ON(&thread_checker_); |
342 | 342 |
343 webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_); | 343 webrtc::VideoSendStream* stream_ RTC_ACCESS_ON(&thread_checker_); |
344 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ | 344 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_ |
345 ACCESS_ON(&thread_checker_); | 345 RTC_ACCESS_ON(&thread_checker_); |
346 // Contains settings that are the same for all streams in the MediaChannel, | 346 // Contains settings that are the same for all streams in the MediaChannel, |
347 // such as codecs, header extensions, and the global bitrate limit for the | 347 // such as codecs, header extensions, and the global bitrate limit for the |
348 // entire channel. | 348 // entire channel. |
349 VideoSendStreamParameters parameters_ ACCESS_ON(&thread_checker_); | 349 VideoSendStreamParameters parameters_ RTC_ACCESS_ON(&thread_checker_); |
350 // Contains settings that are unique for each stream, such as max_bitrate. | 350 // Contains settings that are unique for each stream, such as max_bitrate. |
351 // Does *not* contain codecs, however. | 351 // Does *not* contain codecs, however. |
352 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. | 352 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. |
353 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only | 353 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only |
354 // one stream per MediaChannel. | 354 // one stream per MediaChannel. |
355 webrtc::RtpParameters rtp_parameters_ ACCESS_ON(&thread_checker_); | 355 webrtc::RtpParameters rtp_parameters_ RTC_ACCESS_ON(&thread_checker_); |
356 std::unique_ptr<webrtc::VideoEncoder> allocated_encoder_ | 356 std::unique_ptr<webrtc::VideoEncoder> allocated_encoder_ |
357 ACCESS_ON(&thread_checker_); | 357 RTC_ACCESS_ON(&thread_checker_); |
358 VideoCodec allocated_codec_ ACCESS_ON(&thread_checker_); | 358 VideoCodec allocated_codec_ RTC_ACCESS_ON(&thread_checker_); |
359 | 359 |
360 bool sending_ ACCESS_ON(&thread_checker_); | 360 bool sending_ RTC_ACCESS_ON(&thread_checker_); |
361 }; | 361 }; |
362 | 362 |
363 // Wrapper for the receiver part, contains configs etc. that are needed to | 363 // Wrapper for the receiver part, contains configs etc. that are needed to |
364 // reconstruct the underlying VideoReceiveStream. | 364 // reconstruct the underlying VideoReceiveStream. |
365 class WebRtcVideoReceiveStream | 365 class WebRtcVideoReceiveStream |
366 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 366 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
367 public: | 367 public: |
368 WebRtcVideoReceiveStream( | 368 WebRtcVideoReceiveStream( |
369 webrtc::Call* call, | 369 webrtc::Call* call, |
370 const StreamParams& sp, | 370 const StreamParams& sp, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 webrtc::VideoReceiveStream* stream_; | 430 webrtc::VideoReceiveStream* stream_; |
431 const bool default_stream_; | 431 const bool default_stream_; |
432 webrtc::VideoReceiveStream::Config config_; | 432 webrtc::VideoReceiveStream::Config config_; |
433 webrtc::FlexfecReceiveStream::Config flexfec_config_; | 433 webrtc::FlexfecReceiveStream::Config flexfec_config_; |
434 webrtc::FlexfecReceiveStream* flexfec_stream_; | 434 webrtc::FlexfecReceiveStream* flexfec_stream_; |
435 | 435 |
436 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 436 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
437 std::vector<AllocatedDecoder> allocated_decoders_; | 437 std::vector<AllocatedDecoder> allocated_decoders_; |
438 | 438 |
439 rtc::CriticalSection sink_lock_; | 439 rtc::CriticalSection sink_lock_; |
440 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ GUARDED_BY(sink_lock_); | 440 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ |
| 441 RTC_GUARDED_BY(sink_lock_); |
441 // Expands remote RTP timestamps to int64_t to be able to estimate how long | 442 // Expands remote RTP timestamps to int64_t to be able to estimate how long |
442 // the stream has been running. | 443 // the stream has been running. |
443 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 444 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
444 GUARDED_BY(sink_lock_); | 445 RTC_GUARDED_BY(sink_lock_); |
445 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); | 446 int64_t first_frame_timestamp_ RTC_GUARDED_BY(sink_lock_); |
446 // Start NTP time is estimated as current remote NTP time (estimated from | 447 // Start NTP time is estimated as current remote NTP time (estimated from |
447 // RTCP) minus the elapsed time, as soon as remote NTP time is available. | 448 // RTCP) minus the elapsed time, as soon as remote NTP time is available. |
448 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); | 449 int64_t estimated_remote_start_ntp_time_ms_ RTC_GUARDED_BY(sink_lock_); |
449 }; | 450 }; |
450 | 451 |
451 void Construct(webrtc::Call* call, WebRtcVideoEngine* engine); | 452 void Construct(webrtc::Call* call, WebRtcVideoEngine* engine); |
452 | 453 |
453 bool SendRtp(const uint8_t* data, | 454 bool SendRtp(const uint8_t* data, |
454 size_t len, | 455 size_t len, |
455 const webrtc::PacketOptions& options) override; | 456 const webrtc::PacketOptions& options) override; |
456 bool SendRtcp(const uint8_t* data, size_t len) override; | 457 bool SendRtcp(const uint8_t* data, size_t len) override; |
457 | 458 |
458 static std::vector<VideoCodecSettings> MapCodecs( | 459 static std::vector<VideoCodecSettings> MapCodecs( |
(...skipping 21 matching lines...) Expand all Loading... |
480 webrtc::Call* const call_; | 481 webrtc::Call* const call_; |
481 | 482 |
482 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; | 483 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; |
483 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; | 484 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; |
484 | 485 |
485 const MediaConfig::Video video_config_; | 486 const MediaConfig::Video video_config_; |
486 | 487 |
487 rtc::CriticalSection stream_crit_; | 488 rtc::CriticalSection stream_crit_; |
488 // Using primary-ssrc (first ssrc) as key. | 489 // Using primary-ssrc (first ssrc) as key. |
489 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ | 490 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ |
490 GUARDED_BY(stream_crit_); | 491 RTC_GUARDED_BY(stream_crit_); |
491 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ | 492 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ |
492 GUARDED_BY(stream_crit_); | 493 RTC_GUARDED_BY(stream_crit_); |
493 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); | 494 std::set<uint32_t> send_ssrcs_ RTC_GUARDED_BY(stream_crit_); |
494 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); | 495 std::set<uint32_t> receive_ssrcs_ RTC_GUARDED_BY(stream_crit_); |
495 | 496 |
496 rtc::Optional<VideoCodecSettings> send_codec_; | 497 rtc::Optional<VideoCodecSettings> send_codec_; |
497 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_; | 498 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_; |
498 | 499 |
499 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_; | 500 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_; |
500 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 501 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
501 std::vector<VideoCodecSettings> recv_codecs_; | 502 std::vector<VideoCodecSettings> recv_codecs_; |
502 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 503 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
503 // See reason for keeping track of the FlexFEC payload type separately in | 504 // See reason for keeping track of the FlexFEC payload type separately in |
504 // comment in WebRtcVideoChannel::ChangedRecvParameters. | 505 // comment in WebRtcVideoChannel::ChangedRecvParameters. |
(...skipping 25 matching lines...) Expand all Loading... |
530 const std::string codec_name_; | 531 const std::string codec_name_; |
531 const int max_qp_; | 532 const int max_qp_; |
532 const int max_framerate_; | 533 const int max_framerate_; |
533 const bool is_screencast_; | 534 const bool is_screencast_; |
534 const bool conference_mode_; | 535 const bool conference_mode_; |
535 }; | 536 }; |
536 | 537 |
537 } // namespace cricket | 538 } // namespace cricket |
538 | 539 |
539 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE_H_ | 540 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE_H_ |
OLD | NEW |