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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 return false; | 509 return false; |
510 } | 510 } |
511 SetSendStreamDefaultFormat(sp.first_ssrc()); | 511 SetSendStreamDefaultFormat(sp.first_ssrc()); |
512 return true; | 512 return true; |
513 } | 513 } |
514 virtual bool RemoveSendStream(uint32 ssrc) { | 514 virtual bool RemoveSendStream(uint32 ssrc) { |
515 send_formats_.erase(ssrc); | 515 send_formats_.erase(ssrc); |
516 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); | 516 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); |
517 } | 517 } |
518 | 518 |
519 void DetachVoiceChannel() override {} | |
520 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { | 519 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { |
521 if (fail_set_recv_codecs()) { | 520 if (fail_set_recv_codecs()) { |
522 // Fake the failure in SetRecvCodecs. | 521 // Fake the failure in SetRecvCodecs. |
523 return false; | 522 return false; |
524 } | 523 } |
525 recv_codecs_ = codecs; | 524 recv_codecs_ = codecs; |
526 return true; | 525 return true; |
527 } | 526 } |
528 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) { | 527 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) { |
529 if (fail_set_send_codecs()) { | 528 if (fail_set_send_codecs()) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 delay_offset_(0), | 743 delay_offset_(0), |
745 rx_processor_(NULL), | 744 rx_processor_(NULL), |
746 tx_processor_(NULL) { | 745 tx_processor_(NULL) { |
747 // Add a fake audio codec. Note that the name must not be "" as there are | 746 // Add a fake audio codec. Note that the name must not be "" as there are |
748 // sanity checks against that. | 747 // sanity checks against that. |
749 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); | 748 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); |
750 } | 749 } |
751 bool Init(rtc::Thread* worker_thread) { return true; } | 750 bool Init(rtc::Thread* worker_thread) { return true; } |
752 void Terminate() {} | 751 void Terminate() {} |
753 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } | 752 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } |
| 753 webrtc::VoiceEngine* GetVoE() { return nullptr; } |
754 AudioOptions GetAudioOptions() const { | 754 AudioOptions GetAudioOptions() const { |
755 return options_; | 755 return options_; |
756 } | 756 } |
757 AudioOptions GetOptions() const { | 757 AudioOptions GetOptions() const { |
758 return options_; | 758 return options_; |
759 } | 759 } |
760 bool SetOptions(const AudioOptions& options) { | 760 bool SetOptions(const AudioOptions& options) { |
761 options_ = options; | 761 options_ = options; |
762 options_changed_ = true; | 762 options_changed_ = true; |
763 return true; | 763 return true; |
764 } | 764 } |
765 | 765 |
766 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { | 766 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
| 767 const AudioOptions& options) { |
767 if (fail_create_channel_) { | 768 if (fail_create_channel_) { |
768 return nullptr; | 769 return nullptr; |
769 } | 770 } |
770 | 771 |
771 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this); | 772 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this); |
772 ch->SetOptions(options); | 773 ch->SetOptions(options); |
773 channels_.push_back(ch); | 774 channels_.push_back(ch); |
774 return ch; | 775 return ch; |
775 } | 776 } |
776 FakeVoiceMediaChannel* GetChannel(size_t index) { | 777 FakeVoiceMediaChannel* GetChannel(size_t index) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 std::string out_device_; | 848 std::string out_device_; |
848 VoiceProcessor* rx_processor_; | 849 VoiceProcessor* rx_processor_; |
849 VoiceProcessor* tx_processor_; | 850 VoiceProcessor* tx_processor_; |
850 AudioOptions options_; | 851 AudioOptions options_; |
851 | 852 |
852 friend class FakeMediaEngine; | 853 friend class FakeMediaEngine; |
853 }; | 854 }; |
854 | 855 |
855 class FakeVideoEngine : public FakeBaseEngine { | 856 class FakeVideoEngine : public FakeBaseEngine { |
856 public: | 857 public: |
857 FakeVideoEngine() : FakeVideoEngine(nullptr) {} | 858 FakeVideoEngine() : capture_(false) { |
858 explicit FakeVideoEngine(FakeVoiceEngine* voice) | |
859 : capture_(false) { | |
860 // Add a fake video codec. Note that the name must not be "" as there are | 859 // Add a fake video codec. Note that the name must not be "" as there are |
861 // sanity checks against that. | 860 // sanity checks against that. |
862 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); | 861 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); |
863 } | 862 } |
864 void Init() {} | 863 void Init() {} |
865 bool GetOptions(VideoOptions* options) const { | 864 bool GetOptions(VideoOptions* options) const { |
866 *options = options_; | 865 *options = options_; |
867 return true; | 866 return true; |
868 } | 867 } |
869 bool SetOptions(const VideoOptions& options) { | 868 bool SetOptions(const VideoOptions& options) { |
870 options_ = options; | 869 options_ = options; |
871 options_changed_ = true; | 870 options_changed_ = true; |
872 return true; | 871 return true; |
873 } | 872 } |
874 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } | 873 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } |
875 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { | 874 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { |
876 default_encoder_config_ = config; | 875 default_encoder_config_ = config; |
877 return true; | 876 return true; |
878 } | 877 } |
879 const VideoEncoderConfig& default_encoder_config() const { | 878 const VideoEncoderConfig& default_encoder_config() const { |
880 return default_encoder_config_; | 879 return default_encoder_config_; |
881 } | 880 } |
882 | 881 |
883 VideoMediaChannel* CreateChannel(const VideoOptions& options, | 882 VideoMediaChannel* CreateChannel(webrtc::Call* call, |
884 VoiceMediaChannel* channel) { | 883 const VideoOptions& options) { |
885 if (fail_create_channel_) { | 884 if (fail_create_channel_) { |
886 return NULL; | 885 return NULL; |
887 } | 886 } |
888 | 887 |
889 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this); | 888 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this); |
890 ch->SetOptions(options); | 889 ch->SetOptions(options); |
891 channels_.push_back(ch); | 890 channels_.push_back(ch); |
892 return ch; | 891 return ch; |
893 } | 892 } |
894 FakeVideoMediaChannel* GetChannel(size_t index) { | 893 FakeVideoMediaChannel* GetChannel(size_t index) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 | 1051 |
1053 private: | 1052 private: |
1054 std::vector<FakeDataMediaChannel*> channels_; | 1053 std::vector<FakeDataMediaChannel*> channels_; |
1055 std::vector<DataCodec> data_codecs_; | 1054 std::vector<DataCodec> data_codecs_; |
1056 DataChannelType last_channel_type_; | 1055 DataChannelType last_channel_type_; |
1057 }; | 1056 }; |
1058 | 1057 |
1059 } // namespace cricket | 1058 } // namespace cricket |
1060 | 1059 |
1061 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1060 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |