| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 // relevant setting has been updated. | 763 // relevant setting has been updated. |
| 764 // TODO(thaloun): Replace with explicit checks of before & after values. | 764 // TODO(thaloun): Replace with explicit checks of before & after values. |
| 765 bool options_changed_; | 765 bool options_changed_; |
| 766 bool fail_create_channel_; | 766 bool fail_create_channel_; |
| 767 std::vector<RtpHeaderExtension> rtp_header_extensions_; | 767 std::vector<RtpHeaderExtension> rtp_header_extensions_; |
| 768 }; | 768 }; |
| 769 | 769 |
| 770 class FakeVoiceEngine : public FakeBaseEngine { | 770 class FakeVoiceEngine : public FakeBaseEngine { |
| 771 public: | 771 public: |
| 772 FakeVoiceEngine() | 772 FakeVoiceEngine() |
| 773 : output_volume_(-1), | 773 : output_volume_(-1) { |
| 774 delay_offset_(0) { | |
| 775 // Add a fake audio codec. Note that the name must not be "" as there are | 774 // Add a fake audio codec. Note that the name must not be "" as there are |
| 776 // sanity checks against that. | 775 // sanity checks against that. |
| 777 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); | 776 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); |
| 778 } | 777 } |
| 779 bool Init(rtc::Thread* worker_thread) { return true; } | 778 bool Init(rtc::Thread* worker_thread) { return true; } |
| 780 void Terminate() {} | 779 void Terminate() {} |
| 781 webrtc::VoiceEngine* GetVoE() { return nullptr; } | 780 webrtc::VoiceEngine* GetVoE() { return nullptr; } |
| 782 AudioOptions GetOptions() const { | 781 AudioOptions GetOptions() const { |
| 783 return options_; | 782 return options_; |
| 784 } | 783 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 801 FakeVoiceMediaChannel* GetChannel(size_t index) { | 800 FakeVoiceMediaChannel* GetChannel(size_t index) { |
| 802 return (channels_.size() > index) ? channels_[index] : NULL; | 801 return (channels_.size() > index) ? channels_[index] : NULL; |
| 803 } | 802 } |
| 804 void UnregisterChannel(VoiceMediaChannel* channel) { | 803 void UnregisterChannel(VoiceMediaChannel* channel) { |
| 805 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); | 804 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); |
| 806 } | 805 } |
| 807 | 806 |
| 808 const std::vector<AudioCodec>& codecs() { return codecs_; } | 807 const std::vector<AudioCodec>& codecs() { return codecs_; } |
| 809 void SetCodecs(const std::vector<AudioCodec> codecs) { codecs_ = codecs; } | 808 void SetCodecs(const std::vector<AudioCodec> codecs) { codecs_ = codecs; } |
| 810 | 809 |
| 811 bool SetDelayOffset(int offset) { | |
| 812 delay_offset_ = offset; | |
| 813 return true; | |
| 814 } | |
| 815 | |
| 816 bool SetDevices(const Device* in_device, const Device* out_device) { | 810 bool SetDevices(const Device* in_device, const Device* out_device) { |
| 817 in_device_ = (in_device) ? in_device->name : ""; | 811 in_device_ = (in_device) ? in_device->name : ""; |
| 818 out_device_ = (out_device) ? out_device->name : ""; | 812 out_device_ = (out_device) ? out_device->name : ""; |
| 819 options_changed_ = true; | 813 options_changed_ = true; |
| 820 return true; | 814 return true; |
| 821 } | 815 } |
| 822 | 816 |
| 823 bool GetOutputVolume(int* level) { | 817 bool GetOutputVolume(int* level) { |
| 824 *level = output_volume_; | 818 *level = output_volume_; |
| 825 return true; | 819 return true; |
| 826 } | 820 } |
| 827 | 821 |
| 828 bool SetOutputVolume(int level) { | 822 bool SetOutputVolume(int level) { |
| 829 output_volume_ = level; | 823 output_volume_ = level; |
| 830 options_changed_ = true; | 824 options_changed_ = true; |
| 831 return true; | 825 return true; |
| 832 } | 826 } |
| 833 | 827 |
| 834 int GetInputLevel() { return 0; } | 828 int GetInputLevel() { return 0; } |
| 835 | 829 |
| 836 bool StartAecDump(rtc::PlatformFile file) { return false; } | 830 bool StartAecDump(rtc::PlatformFile file) { return false; } |
| 837 | 831 |
| 838 private: | 832 private: |
| 839 std::vector<FakeVoiceMediaChannel*> channels_; | 833 std::vector<FakeVoiceMediaChannel*> channels_; |
| 840 std::vector<AudioCodec> codecs_; | 834 std::vector<AudioCodec> codecs_; |
| 841 int output_volume_; | 835 int output_volume_; |
| 842 int delay_offset_; | |
| 843 std::string in_device_; | 836 std::string in_device_; |
| 844 std::string out_device_; | 837 std::string out_device_; |
| 845 AudioOptions options_; | 838 AudioOptions options_; |
| 846 | 839 |
| 847 friend class FakeMediaEngine; | 840 friend class FakeMediaEngine; |
| 848 }; | 841 }; |
| 849 | 842 |
| 850 class FakeVideoEngine : public FakeBaseEngine { | 843 class FakeVideoEngine : public FakeBaseEngine { |
| 851 public: | 844 public: |
| 852 FakeVideoEngine() : capture_(false) { | 845 FakeVideoEngine() : capture_(false) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 936 } |
| 944 | 937 |
| 945 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { | 938 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { |
| 946 return voice_.GetChannel(index); | 939 return voice_.GetChannel(index); |
| 947 } | 940 } |
| 948 FakeVideoMediaChannel* GetVideoChannel(size_t index) { | 941 FakeVideoMediaChannel* GetVideoChannel(size_t index) { |
| 949 return video_.GetChannel(index); | 942 return video_.GetChannel(index); |
| 950 } | 943 } |
| 951 | 944 |
| 952 AudioOptions audio_options() const { return voice_.options_; } | 945 AudioOptions audio_options() const { return voice_.options_; } |
| 953 int audio_delay_offset() const { return voice_.delay_offset_; } | |
| 954 int output_volume() const { return voice_.output_volume_; } | 946 int output_volume() const { return voice_.output_volume_; } |
| 955 const VideoEncoderConfig& default_video_encoder_config() const { | 947 const VideoEncoderConfig& default_video_encoder_config() const { |
| 956 return video_.default_encoder_config_; | 948 return video_.default_encoder_config_; |
| 957 } | 949 } |
| 958 const std::string& audio_in_device() const { return voice_.in_device_; } | 950 const std::string& audio_in_device() const { return voice_.in_device_; } |
| 959 const std::string& audio_out_device() const { return voice_.out_device_; } | 951 const std::string& audio_out_device() const { return voice_.out_device_; } |
| 960 int voice_loglevel() const { return voice_.loglevel_; } | 952 int voice_loglevel() const { return voice_.loglevel_; } |
| 961 const std::string& voice_logfilter() const { return voice_.logfilter_; } | 953 const std::string& voice_logfilter() const { return voice_.logfilter_; } |
| 962 int video_loglevel() const { return video_.loglevel_; } | 954 int video_loglevel() const { return video_.loglevel_; } |
| 963 const std::string& video_logfilter() const { return video_.logfilter_; } | 955 const std::string& video_logfilter() const { return video_.logfilter_; } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1023 |
| 1032 private: | 1024 private: |
| 1033 std::vector<FakeDataMediaChannel*> channels_; | 1025 std::vector<FakeDataMediaChannel*> channels_; |
| 1034 std::vector<DataCodec> data_codecs_; | 1026 std::vector<DataCodec> data_codecs_; |
| 1035 DataChannelType last_channel_type_; | 1027 DataChannelType last_channel_type_; |
| 1036 }; | 1028 }; |
| 1037 | 1029 |
| 1038 } // namespace cricket | 1030 } // namespace cricket |
| 1039 | 1031 |
| 1040 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1032 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |