| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 return false; | 516 return false; |
| 517 } | 517 } |
| 518 SetSendStreamDefaultFormat(sp.first_ssrc()); | 518 SetSendStreamDefaultFormat(sp.first_ssrc()); |
| 519 return true; | 519 return true; |
| 520 } | 520 } |
| 521 virtual bool RemoveSendStream(uint32 ssrc) { | 521 virtual bool RemoveSendStream(uint32 ssrc) { |
| 522 send_formats_.erase(ssrc); | 522 send_formats_.erase(ssrc); |
| 523 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); | 523 return RtpHelper<VideoMediaChannel>::RemoveSendStream(ssrc); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void DetachVoiceChannel() override {} | |
| 527 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { | 526 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) { |
| 528 if (fail_set_recv_codecs()) { | 527 if (fail_set_recv_codecs()) { |
| 529 // Fake the failure in SetRecvCodecs. | 528 // Fake the failure in SetRecvCodecs. |
| 530 return false; | 529 return false; |
| 531 } | 530 } |
| 532 recv_codecs_ = codecs; | 531 recv_codecs_ = codecs; |
| 533 return true; | 532 return true; |
| 534 } | 533 } |
| 535 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) { | 534 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) { |
| 536 if (fail_set_send_codecs()) { | 535 if (fail_set_send_codecs()) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 delay_offset_(0), | 757 delay_offset_(0), |
| 759 rx_processor_(NULL), | 758 rx_processor_(NULL), |
| 760 tx_processor_(NULL) { | 759 tx_processor_(NULL) { |
| 761 // Add a fake audio codec. Note that the name must not be "" as there are | 760 // Add a fake audio codec. Note that the name must not be "" as there are |
| 762 // sanity checks against that. | 761 // sanity checks against that. |
| 763 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); | 762 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); |
| 764 } | 763 } |
| 765 bool Init(rtc::Thread* worker_thread) { return true; } | 764 bool Init(rtc::Thread* worker_thread) { return true; } |
| 766 void Terminate() {} | 765 void Terminate() {} |
| 767 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } | 766 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } |
| 767 webrtc::VoiceEngine* GetVoE() { return nullptr; } |
| 768 AudioOptions GetOptions() const { | 768 AudioOptions GetOptions() const { |
| 769 return options_; | 769 return options_; |
| 770 } | 770 } |
| 771 bool SetOptions(const AudioOptions& options) { | 771 bool SetOptions(const AudioOptions& options) { |
| 772 options_ = options; | 772 options_ = options; |
| 773 options_changed_ = true; | 773 options_changed_ = true; |
| 774 return true; | 774 return true; |
| 775 } | 775 } |
| 776 | 776 |
| 777 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { | 777 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
| 778 const AudioOptions& options) { |
| 778 if (fail_create_channel_) { | 779 if (fail_create_channel_) { |
| 779 return nullptr; | 780 return nullptr; |
| 780 } | 781 } |
| 781 | 782 |
| 782 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this); | 783 FakeVoiceMediaChannel* ch = new FakeVoiceMediaChannel(this); |
| 783 ch->SetOptions(options); | 784 ch->SetOptions(options); |
| 784 channels_.push_back(ch); | 785 channels_.push_back(ch); |
| 785 return ch; | 786 return ch; |
| 786 } | 787 } |
| 787 FakeVoiceMediaChannel* GetChannel(size_t index) { | 788 FakeVoiceMediaChannel* GetChannel(size_t index) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 std::string out_device_; | 859 std::string out_device_; |
| 859 VoiceProcessor* rx_processor_; | 860 VoiceProcessor* rx_processor_; |
| 860 VoiceProcessor* tx_processor_; | 861 VoiceProcessor* tx_processor_; |
| 861 AudioOptions options_; | 862 AudioOptions options_; |
| 862 | 863 |
| 863 friend class FakeMediaEngine; | 864 friend class FakeMediaEngine; |
| 864 }; | 865 }; |
| 865 | 866 |
| 866 class FakeVideoEngine : public FakeBaseEngine { | 867 class FakeVideoEngine : public FakeBaseEngine { |
| 867 public: | 868 public: |
| 868 FakeVideoEngine() : FakeVideoEngine(nullptr) {} | 869 FakeVideoEngine() : capture_(false) { |
| 869 explicit FakeVideoEngine(FakeVoiceEngine* voice) | |
| 870 : capture_(false) { | |
| 871 // Add a fake video codec. Note that the name must not be "" as there are | 870 // Add a fake video codec. Note that the name must not be "" as there are |
| 872 // sanity checks against that. | 871 // sanity checks against that. |
| 873 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); | 872 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); |
| 874 } | 873 } |
| 875 void Init() {} | 874 void Init() {} |
| 876 bool SetOptions(const VideoOptions& options) { | 875 bool SetOptions(const VideoOptions& options) { |
| 877 options_ = options; | 876 options_ = options; |
| 878 options_changed_ = true; | 877 options_changed_ = true; |
| 879 return true; | 878 return true; |
| 880 } | 879 } |
| 881 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } | 880 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } |
| 882 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { | 881 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { |
| 883 default_encoder_config_ = config; | 882 default_encoder_config_ = config; |
| 884 return true; | 883 return true; |
| 885 } | 884 } |
| 886 const VideoEncoderConfig& default_encoder_config() const { | 885 const VideoEncoderConfig& default_encoder_config() const { |
| 887 return default_encoder_config_; | 886 return default_encoder_config_; |
| 888 } | 887 } |
| 889 | 888 |
| 890 VideoMediaChannel* CreateChannel(const VideoOptions& options, | 889 VideoMediaChannel* CreateChannel(webrtc::Call* call, |
| 891 VoiceMediaChannel* channel) { | 890 const VideoOptions& options) { |
| 892 if (fail_create_channel_) { | 891 if (fail_create_channel_) { |
| 893 return NULL; | 892 return NULL; |
| 894 } | 893 } |
| 895 | 894 |
| 896 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this); | 895 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this); |
| 897 ch->SetOptions(options); | 896 ch->SetOptions(options); |
| 898 channels_.push_back(ch); | 897 channels_.push_back(ch); |
| 899 return ch; | 898 return ch; |
| 900 } | 899 } |
| 901 FakeVideoMediaChannel* GetChannel(size_t index) { | 900 FakeVideoMediaChannel* GetChannel(size_t index) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1058 |
| 1060 private: | 1059 private: |
| 1061 std::vector<FakeDataMediaChannel*> channels_; | 1060 std::vector<FakeDataMediaChannel*> channels_; |
| 1062 std::vector<DataCodec> data_codecs_; | 1061 std::vector<DataCodec> data_codecs_; |
| 1063 DataChannelType last_channel_type_; | 1062 DataChannelType last_channel_type_; |
| 1064 }; | 1063 }; |
| 1065 | 1064 |
| 1066 } // namespace cricket | 1065 } // namespace cricket |
| 1067 | 1066 |
| 1068 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1067 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |