OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 static std::string MakeTdErrorString(const std::string& desc) { | 438 static std::string MakeTdErrorString(const std::string& desc) { |
439 return MakeErrorString(kPushDownTDFailed, desc); | 439 return MakeErrorString(kPushDownTDFailed, desc); |
440 } | 440 } |
441 | 441 |
442 // Set |option| to the highest-priority value of |key| in the optional | 442 // Set |option| to the highest-priority value of |key| in the optional |
443 // constraints if the key is found and has a valid value. | 443 // constraints if the key is found and has a valid value. |
444 template <typename T> | 444 template <typename T> |
445 static void SetOptionFromOptionalConstraint( | 445 static void SetOptionFromOptionalConstraint( |
446 const MediaConstraintsInterface* constraints, | 446 const MediaConstraintsInterface* constraints, |
447 const std::string& key, | 447 const std::string& key, |
448 rtc::Maybe<T>* option) { | 448 rtc::Optional<T>* option) { |
449 if (!constraints) { | 449 if (!constraints) { |
450 return; | 450 return; |
451 } | 451 } |
452 std::string string_value; | 452 std::string string_value; |
453 T value; | 453 T value; |
454 if (constraints->GetOptional().FindFirst(key, &string_value)) { | 454 if (constraints->GetOptional().FindFirst(key, &string_value)) { |
455 if (rtc::FromString(string_value, &value)) { | 455 if (rtc::FromString(string_value, &value)) { |
456 *option = rtc::Maybe<T>(value); | 456 *option = rtc::Optional<T>(value); |
457 } | 457 } |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 uint32_t ConvertIceTransportTypeToCandidateFilter( | 461 uint32_t ConvertIceTransportTypeToCandidateFilter( |
462 PeerConnectionInterface::IceTransportsType type) { | 462 PeerConnectionInterface::IceTransportsType type) { |
463 switch (type) { | 463 switch (type) { |
464 case PeerConnectionInterface::kNone: | 464 case PeerConnectionInterface::kNone: |
465 return cricket::CF_NONE; | 465 return cricket::CF_NONE; |
466 case PeerConnectionInterface::kRelay: | 466 case PeerConnectionInterface::kRelay: |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 LOG(LS_INFO) << "Allowing SCTP data engine."; | 638 LOG(LS_INFO) << "Allowing SCTP data engine."; |
639 data_channel_type_ = cricket::DCT_SCTP; | 639 data_channel_type_ = cricket::DCT_SCTP; |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 // Find DSCP constraint. | 643 // Find DSCP constraint. |
644 if (FindConstraint( | 644 if (FindConstraint( |
645 constraints, | 645 constraints, |
646 MediaConstraintsInterface::kEnableDscp, | 646 MediaConstraintsInterface::kEnableDscp, |
647 &value, NULL)) { | 647 &value, NULL)) { |
648 audio_options_.dscp = rtc::Maybe<bool>(value); | 648 audio_options_.dscp = rtc::Optional<bool>(value); |
649 video_options_.dscp = rtc::Maybe<bool>(value); | 649 video_options_.dscp = rtc::Optional<bool>(value); |
650 } | 650 } |
651 | 651 |
652 // Find Suspend Below Min Bitrate constraint. | 652 // Find Suspend Below Min Bitrate constraint. |
653 if (FindConstraint( | 653 if (FindConstraint( |
654 constraints, | 654 constraints, |
655 MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, | 655 MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, |
656 &value, | 656 &value, |
657 NULL)) { | 657 NULL)) { |
658 video_options_.suspend_below_min_bitrate = rtc::Maybe<bool>(value); | 658 video_options_.suspend_below_min_bitrate = rtc::Optional<bool>(value); |
659 } | 659 } |
660 | 660 |
661 SetOptionFromOptionalConstraint(constraints, | 661 SetOptionFromOptionalConstraint(constraints, |
662 MediaConstraintsInterface::kScreencastMinBitrate, | 662 MediaConstraintsInterface::kScreencastMinBitrate, |
663 &video_options_.screencast_min_bitrate); | 663 &video_options_.screencast_min_bitrate); |
664 | 664 |
665 // Find constraints for cpu overuse detection. | 665 // Find constraints for cpu overuse detection. |
666 SetOptionFromOptionalConstraint(constraints, | 666 SetOptionFromOptionalConstraint(constraints, |
667 MediaConstraintsInterface::kCpuUnderuseThreshold, | 667 MediaConstraintsInterface::kCpuUnderuseThreshold, |
668 &video_options_.cpu_underuse_threshold); | 668 &video_options_.cpu_underuse_threshold); |
(...skipping 10 matching lines...) Expand all Loading... |
679 MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold, | 679 MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold, |
680 &video_options_.cpu_underuse_encode_rsd_threshold); | 680 &video_options_.cpu_underuse_encode_rsd_threshold); |
681 SetOptionFromOptionalConstraint(constraints, | 681 SetOptionFromOptionalConstraint(constraints, |
682 MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold, | 682 MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold, |
683 &video_options_.cpu_overuse_encode_rsd_threshold); | 683 &video_options_.cpu_overuse_encode_rsd_threshold); |
684 | 684 |
685 SetOptionFromOptionalConstraint(constraints, | 685 SetOptionFromOptionalConstraint(constraints, |
686 MediaConstraintsInterface::kNumUnsignalledRecvStreams, | 686 MediaConstraintsInterface::kNumUnsignalledRecvStreams, |
687 &video_options_.unsignalled_recv_stream_limit); | 687 &video_options_.unsignalled_recv_stream_limit); |
688 if (video_options_.unsignalled_recv_stream_limit) { | 688 if (video_options_.unsignalled_recv_stream_limit) { |
689 video_options_.unsignalled_recv_stream_limit = rtc::Maybe<int>( | 689 video_options_.unsignalled_recv_stream_limit = rtc::Optional<int>( |
690 std::max(0, std::min(kMaxUnsignalledRecvStreams, | 690 std::max(0, std::min(kMaxUnsignalledRecvStreams, |
691 *video_options_.unsignalled_recv_stream_limit))); | 691 *video_options_.unsignalled_recv_stream_limit))); |
692 } | 692 } |
693 | 693 |
694 SetOptionFromOptionalConstraint(constraints, | 694 SetOptionFromOptionalConstraint(constraints, |
695 MediaConstraintsInterface::kHighStartBitrate, | 695 MediaConstraintsInterface::kHighStartBitrate, |
696 &video_options_.video_start_bitrate); | 696 &video_options_.video_start_bitrate); |
697 | 697 |
698 SetOptionFromOptionalConstraint(constraints, | 698 SetOptionFromOptionalConstraint(constraints, |
699 MediaConstraintsInterface::kCombinedAudioVideoBwe, | 699 MediaConstraintsInterface::kCombinedAudioVideoBwe, |
700 &audio_options_.combined_audio_video_bwe); | 700 &audio_options_.combined_audio_video_bwe); |
701 | 701 |
702 audio_options_.audio_jitter_buffer_max_packets = | 702 audio_options_.audio_jitter_buffer_max_packets = |
703 rtc::Maybe<int>(rtc_configuration.audio_jitter_buffer_max_packets); | 703 rtc::Optional<int>(rtc_configuration.audio_jitter_buffer_max_packets); |
704 | 704 |
705 audio_options_.audio_jitter_buffer_fast_accelerate = | 705 audio_options_.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>( |
706 rtc::Maybe<bool>(rtc_configuration.audio_jitter_buffer_fast_accelerate); | 706 rtc_configuration.audio_jitter_buffer_fast_accelerate); |
707 | 707 |
708 const cricket::VideoCodec default_codec( | 708 const cricket::VideoCodec default_codec( |
709 JsepSessionDescription::kDefaultVideoCodecId, | 709 JsepSessionDescription::kDefaultVideoCodecId, |
710 JsepSessionDescription::kDefaultVideoCodecName, | 710 JsepSessionDescription::kDefaultVideoCodecName, |
711 JsepSessionDescription::kMaxVideoCodecWidth, | 711 JsepSessionDescription::kMaxVideoCodecWidth, |
712 JsepSessionDescription::kMaxVideoCodecHeight, | 712 JsepSessionDescription::kMaxVideoCodecHeight, |
713 JsepSessionDescription::kDefaultVideoCodecFramerate, | 713 JsepSessionDescription::kDefaultVideoCodecFramerate, |
714 JsepSessionDescription::kDefaultVideoCodecPreference); | 714 JsepSessionDescription::kDefaultVideoCodecPreference); |
715 channel_manager_->SetDefaultVideoEncoderConfig( | 715 channel_manager_->SetDefaultVideoEncoderConfig( |
716 cricket::VideoEncoderConfig(default_codec)); | 716 cricket::VideoEncoderConfig(default_codec)); |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 } | 2194 } |
2195 } | 2195 } |
2196 | 2196 |
2197 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2197 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
2198 const rtc::SentPacket& sent_packet) { | 2198 const rtc::SentPacket& sent_packet) { |
2199 RTC_DCHECK(worker_thread()->IsCurrent()); | 2199 RTC_DCHECK(worker_thread()->IsCurrent()); |
2200 media_controller_->call_w()->OnSentPacket(sent_packet); | 2200 media_controller_->call_w()->OnSentPacket(sent_packet); |
2201 } | 2201 } |
2202 | 2202 |
2203 } // namespace webrtc | 2203 } // namespace webrtc |
OLD | NEW |