OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 bool options_changed_; | 732 bool options_changed_; |
733 bool fail_create_channel_; | 733 bool fail_create_channel_; |
734 RtpCapabilities capabilities_; | 734 RtpCapabilities capabilities_; |
735 }; | 735 }; |
736 | 736 |
737 class FakeVoiceEngine : public FakeBaseEngine { | 737 class FakeVoiceEngine : public FakeBaseEngine { |
738 public: | 738 public: |
739 FakeVoiceEngine( | 739 FakeVoiceEngine( |
740 webrtc::AudioDeviceModule* adm, | 740 webrtc::AudioDeviceModule* adm, |
741 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& | 741 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& |
742 audio_decoder_factory) | 742 audio_decoder_factory) { |
743 : output_volume_(-1) { | |
744 // Add a fake audio codec. Note that the name must not be "" as there are | 743 // Add a fake audio codec. Note that the name must not be "" as there are |
745 // sanity checks against that. | 744 // sanity checks against that. |
746 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1)); | 745 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1)); |
747 } | 746 } |
748 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { | 747 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { |
749 return rtc::scoped_refptr<webrtc::AudioState>(); | 748 return rtc::scoped_refptr<webrtc::AudioState>(); |
750 } | 749 } |
751 | 750 |
752 VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 751 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
753 const MediaConfig& config, | 752 const MediaConfig& config, |
754 const AudioOptions& options) { | 753 const AudioOptions& options) { |
755 if (fail_create_channel_) { | 754 if (fail_create_channel_) { |
756 return nullptr; | 755 return nullptr; |
757 } | 756 } |
758 | 757 |
759 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this, options); | 758 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this, options); |
760 channels_.push_back(ch); | 759 channels_.push_back(ch); |
761 return ch; | 760 return ch; |
762 } | 761 } |
763 FakeVoiceMediaChannel* GetChannel(size_t index) { | 762 FakeVoiceMediaChannel* GetChannel(size_t index) { |
764 return (channels_.size() > index) ? channels_[index] : NULL; | 763 return (channels_.size() > index) ? channels_[index] : NULL; |
765 } | 764 } |
766 void UnregisterChannel(VoiceMediaChannel* channel) { | 765 void UnregisterChannel(VoiceMediaChannel* channel) { |
767 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); | 766 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); |
768 } | 767 } |
769 | 768 |
770 const std::vector<AudioCodec>& codecs() { return codecs_; } | 769 const std::vector<AudioCodec>& codecs() { return codecs_; } |
771 void SetCodecs(const std::vector<AudioCodec> codecs) { codecs_ = codecs; } | 770 void SetCodecs(const std::vector<AudioCodec> codecs) { codecs_ = codecs; } |
772 | 771 |
773 bool GetOutputVolume(int* level) { | |
774 *level = output_volume_; | |
775 return true; | |
776 } | |
777 bool SetOutputVolume(int level) { | |
778 output_volume_ = level; | |
779 return true; | |
780 } | |
781 | |
782 int GetInputLevel() { return 0; } | 772 int GetInputLevel() { return 0; } |
783 | 773 |
784 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { | 774 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { |
785 return false; | 775 return false; |
786 } | 776 } |
787 | 777 |
788 void StopAecDump() {} | 778 void StopAecDump() {} |
789 | 779 |
790 bool StartRtcEventLog(rtc::PlatformFile file, int64_t max_size_bytes) { | 780 bool StartRtcEventLog(rtc::PlatformFile file, int64_t max_size_bytes) { |
791 return false; | 781 return false; |
792 } | 782 } |
793 | 783 |
794 void StopRtcEventLog() {} | 784 void StopRtcEventLog() {} |
795 | 785 |
796 private: | 786 private: |
797 std::vector<FakeVoiceMediaChannel*> channels_; | 787 std::vector<FakeVoiceMediaChannel*> channels_; |
798 std::vector<AudioCodec> codecs_; | 788 std::vector<AudioCodec> codecs_; |
799 int output_volume_; | |
800 | 789 |
801 friend class FakeMediaEngine; | 790 friend class FakeMediaEngine; |
802 }; | 791 }; |
803 | 792 |
804 class FakeVideoEngine : public FakeBaseEngine { | 793 class FakeVideoEngine : public FakeBaseEngine { |
805 public: | 794 public: |
806 FakeVideoEngine() : capture_(false) { | 795 FakeVideoEngine() : capture_(false) { |
807 // Add a fake video codec. Note that the name must not be "" as there are | 796 // Add a fake video codec. Note that the name must not be "" as there are |
808 // sanity checks against that. | 797 // sanity checks against that. |
809 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0)); | 798 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 video_.set_rtp_header_extensions(extensions); | 872 video_.set_rtp_header_extensions(extensions); |
884 } | 873 } |
885 | 874 |
886 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { | 875 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { |
887 return voice_.GetChannel(index); | 876 return voice_.GetChannel(index); |
888 } | 877 } |
889 FakeVideoMediaChannel* GetVideoChannel(size_t index) { | 878 FakeVideoMediaChannel* GetVideoChannel(size_t index) { |
890 return video_.GetChannel(index); | 879 return video_.GetChannel(index); |
891 } | 880 } |
892 | 881 |
893 int output_volume() const { return voice_.output_volume_; } | |
894 bool capture() const { return video_.capture_; } | 882 bool capture() const { return video_.capture_; } |
895 bool options_changed() const { | 883 bool options_changed() const { |
896 return video_.options_changed_; | 884 return video_.options_changed_; |
897 } | 885 } |
898 void clear_options_changed() { | 886 void clear_options_changed() { |
899 video_.options_changed_ = false; | 887 video_.options_changed_ = false; |
900 } | 888 } |
901 void set_fail_create_channel(bool fail) { | 889 void set_fail_create_channel(bool fail) { |
902 voice_.set_fail_create_channel(fail); | 890 voice_.set_fail_create_channel(fail); |
903 video_.set_fail_create_channel(fail); | 891 video_.set_fail_create_channel(fail); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 | 948 |
961 private: | 949 private: |
962 std::vector<FakeDataMediaChannel*> channels_; | 950 std::vector<FakeDataMediaChannel*> channels_; |
963 std::vector<DataCodec> data_codecs_; | 951 std::vector<DataCodec> data_codecs_; |
964 DataChannelType last_channel_type_; | 952 DataChannelType last_channel_type_; |
965 }; | 953 }; |
966 | 954 |
967 } // namespace cricket | 955 } // namespace cricket |
968 | 956 |
969 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 957 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |