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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 // Add a fake video codec. Note that the name must not be "" as there are | 776 // Add a fake video codec. Note that the name must not be "" as there are |
777 // sanity checks against that. | 777 // sanity checks against that. |
778 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); | 778 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); |
779 } | 779 } |
780 void Init() {} | 780 void Init() {} |
781 bool SetOptions(const VideoOptions& options) { | 781 bool SetOptions(const VideoOptions& options) { |
782 options_ = options; | 782 options_ = options; |
783 options_changed_ = true; | 783 options_changed_ = true; |
784 return true; | 784 return true; |
785 } | 785 } |
786 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { | |
787 default_encoder_config_ = config; | |
788 return true; | |
789 } | |
790 const VideoEncoderConfig& default_encoder_config() const { | |
791 return default_encoder_config_; | |
792 } | |
793 | 786 |
794 VideoMediaChannel* CreateChannel(webrtc::Call* call, | 787 VideoMediaChannel* CreateChannel(webrtc::Call* call, |
795 const VideoOptions& options) { | 788 const VideoOptions& options) { |
796 if (fail_create_channel_) { | 789 if (fail_create_channel_) { |
797 return NULL; | 790 return NULL; |
798 } | 791 } |
799 | 792 |
800 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this, options); | 793 FakeVideoMediaChannel* ch = new FakeVideoMediaChannel(this, options); |
801 channels_.push_back(ch); | 794 channels_.push_back(ch); |
802 return ch; | 795 return ch; |
(...skipping 22 matching lines...) Expand all Loading... |
825 return true; | 818 return true; |
826 } | 819 } |
827 bool SetCapture(bool capture) { | 820 bool SetCapture(bool capture) { |
828 capture_ = capture; | 821 capture_ = capture; |
829 return true; | 822 return true; |
830 } | 823 } |
831 | 824 |
832 private: | 825 private: |
833 std::vector<FakeVideoMediaChannel*> channels_; | 826 std::vector<FakeVideoMediaChannel*> channels_; |
834 std::vector<VideoCodec> codecs_; | 827 std::vector<VideoCodec> codecs_; |
835 VideoEncoderConfig default_encoder_config_; | |
836 std::string in_device_; | 828 std::string in_device_; |
837 bool capture_; | 829 bool capture_; |
838 VideoOptions options_; | 830 VideoOptions options_; |
839 | 831 |
840 friend class FakeMediaEngine; | 832 friend class FakeMediaEngine; |
841 }; | 833 }; |
842 | 834 |
843 class FakeMediaEngine : | 835 class FakeMediaEngine : |
844 public CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine> { | 836 public CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine> { |
845 public: | 837 public: |
(...skipping 17 matching lines...) Expand all Loading... |
863 } | 855 } |
864 | 856 |
865 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { | 857 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { |
866 return voice_.GetChannel(index); | 858 return voice_.GetChannel(index); |
867 } | 859 } |
868 FakeVideoMediaChannel* GetVideoChannel(size_t index) { | 860 FakeVideoMediaChannel* GetVideoChannel(size_t index) { |
869 return video_.GetChannel(index); | 861 return video_.GetChannel(index); |
870 } | 862 } |
871 | 863 |
872 int output_volume() const { return voice_.output_volume_; } | 864 int output_volume() const { return voice_.output_volume_; } |
873 const VideoEncoderConfig& default_video_encoder_config() const { | |
874 return video_.default_encoder_config_; | |
875 } | |
876 bool capture() const { return video_.capture_; } | 865 bool capture() const { return video_.capture_; } |
877 bool options_changed() const { | 866 bool options_changed() const { |
878 return video_.options_changed_; | 867 return video_.options_changed_; |
879 } | 868 } |
880 void clear_options_changed() { | 869 void clear_options_changed() { |
881 video_.options_changed_ = false; | 870 video_.options_changed_ = false; |
882 } | 871 } |
883 void set_fail_create_channel(bool fail) { | 872 void set_fail_create_channel(bool fail) { |
884 voice_.set_fail_create_channel(fail); | 873 voice_.set_fail_create_channel(fail); |
885 video_.set_fail_create_channel(fail); | 874 video_.set_fail_create_channel(fail); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 931 |
943 private: | 932 private: |
944 std::vector<FakeDataMediaChannel*> channels_; | 933 std::vector<FakeDataMediaChannel*> channels_; |
945 std::vector<DataCodec> data_codecs_; | 934 std::vector<DataCodec> data_codecs_; |
946 DataChannelType last_channel_type_; | 935 DataChannelType last_channel_type_; |
947 }; | 936 }; |
948 | 937 |
949 } // namespace cricket | 938 } // namespace cricket |
950 | 939 |
951 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 940 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |