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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void set_fail_set_send(bool fail) { fail_set_send_ = fail; } | 403 void set_fail_set_send(bool fail) { fail_set_send_ = fail; } |
404 void TriggerError(uint32 ssrc, VoiceMediaChannel::Error error) { | 404 void TriggerError(uint32 ssrc, VoiceMediaChannel::Error error) { |
405 VoiceMediaChannel::SignalMediaError(ssrc, error); | 405 VoiceMediaChannel::SignalMediaError(ssrc, error); |
406 } | 406 } |
407 | 407 |
408 virtual bool SetOptions(const AudioOptions& options) { | 408 virtual bool SetOptions(const AudioOptions& options) { |
409 // Does a "merge" of current options and set options. | 409 // Does a "merge" of current options and set options. |
410 options_.SetAll(options); | 410 options_.SetAll(options); |
411 return true; | 411 return true; |
412 } | 412 } |
413 virtual bool GetOptions(AudioOptions* options) const { | |
414 *options = options_; | |
415 return true; | |
416 } | |
417 | 413 |
418 private: | 414 private: |
419 struct OutputScaling { | 415 struct OutputScaling { |
420 OutputScaling() : left(1.0), right(1.0) {} | 416 OutputScaling() : left(1.0), right(1.0) {} |
421 double left, right; | 417 double left, right; |
422 }; | 418 }; |
423 | 419 |
424 class VoiceChannelAudioSink : public AudioRenderer::Sink { | 420 class VoiceChannelAudioSink : public AudioRenderer::Sink { |
425 public: | 421 public: |
426 explicit VoiceChannelAudioSink(AudioRenderer* renderer) | 422 explicit VoiceChannelAudioSink(AudioRenderer* renderer) |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return true; | 586 return true; |
591 } | 587 } |
592 virtual bool RequestIntraFrame() { | 588 virtual bool RequestIntraFrame() { |
593 requested_intra_frame_ = true; | 589 requested_intra_frame_ = true; |
594 return true; | 590 return true; |
595 } | 591 } |
596 virtual bool SetOptions(const VideoOptions& options) { | 592 virtual bool SetOptions(const VideoOptions& options) { |
597 options_ = options; | 593 options_ = options; |
598 return true; | 594 return true; |
599 } | 595 } |
600 virtual bool GetOptions(VideoOptions* options) const { | |
601 *options = options_; | |
602 return true; | |
603 } | |
604 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) {} | 596 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) {} |
605 void set_sent_intra_frame(bool v) { sent_intra_frame_ = v; } | 597 void set_sent_intra_frame(bool v) { sent_intra_frame_ = v; } |
606 bool sent_intra_frame() const { return sent_intra_frame_; } | 598 bool sent_intra_frame() const { return sent_intra_frame_; } |
607 void set_requested_intra_frame(bool v) { requested_intra_frame_ = v; } | 599 void set_requested_intra_frame(bool v) { requested_intra_frame_ = v; } |
608 bool requested_intra_frame() const { return requested_intra_frame_; } | 600 bool requested_intra_frame() const { return requested_intra_frame_; } |
609 | 601 |
610 private: | 602 private: |
611 // Be default, each send stream uses the first send codec format. | 603 // Be default, each send stream uses the first send codec format. |
612 void SetSendStreamDefaultFormat(uint32 ssrc) { | 604 void SetSendStreamDefaultFormat(uint32 ssrc) { |
613 if (!send_codecs_.empty()) { | 605 if (!send_codecs_.empty()) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 delay_offset_(0), | 736 delay_offset_(0), |
745 rx_processor_(NULL), | 737 rx_processor_(NULL), |
746 tx_processor_(NULL) { | 738 tx_processor_(NULL) { |
747 // Add a fake audio codec. Note that the name must not be "" as there are | 739 // Add a fake audio codec. Note that the name must not be "" as there are |
748 // sanity checks against that. | 740 // sanity checks against that. |
749 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); | 741 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1, 0)); |
750 } | 742 } |
751 bool Init(rtc::Thread* worker_thread) { return true; } | 743 bool Init(rtc::Thread* worker_thread) { return true; } |
752 void Terminate() {} | 744 void Terminate() {} |
753 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } | 745 int GetCapabilities() { return AUDIO_SEND | AUDIO_RECV; } |
754 AudioOptions GetAudioOptions() const { | |
755 return options_; | |
756 } | |
757 AudioOptions GetOptions() const { | 746 AudioOptions GetOptions() const { |
758 return options_; | 747 return options_; |
759 } | 748 } |
760 bool SetOptions(const AudioOptions& options) { | 749 bool SetOptions(const AudioOptions& options) { |
761 options_ = options; | 750 options_ = options; |
762 options_changed_ = true; | 751 options_changed_ = true; |
763 return true; | 752 return true; |
764 } | 753 } |
765 | 754 |
766 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { | 755 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 class FakeVideoEngine : public FakeBaseEngine { | 844 class FakeVideoEngine : public FakeBaseEngine { |
856 public: | 845 public: |
857 FakeVideoEngine() : FakeVideoEngine(nullptr) {} | 846 FakeVideoEngine() : FakeVideoEngine(nullptr) {} |
858 explicit FakeVideoEngine(FakeVoiceEngine* voice) | 847 explicit FakeVideoEngine(FakeVoiceEngine* voice) |
859 : capture_(false) { | 848 : capture_(false) { |
860 // Add a fake video codec. Note that the name must not be "" as there are | 849 // Add a fake video codec. Note that the name must not be "" as there are |
861 // sanity checks against that. | 850 // sanity checks against that. |
862 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); | 851 codecs_.push_back(VideoCodec(0, "fake_video_codec", 0, 0, 0, 0)); |
863 } | 852 } |
864 void Init() {} | 853 void Init() {} |
865 bool GetOptions(VideoOptions* options) const { | |
866 *options = options_; | |
867 return true; | |
868 } | |
869 bool SetOptions(const VideoOptions& options) { | 854 bool SetOptions(const VideoOptions& options) { |
870 options_ = options; | 855 options_ = options; |
871 options_changed_ = true; | 856 options_changed_ = true; |
872 return true; | 857 return true; |
873 } | 858 } |
874 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } | 859 int GetCapabilities() { return VIDEO_SEND | VIDEO_RECV; } |
875 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { | 860 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { |
876 default_encoder_config_ = config; | 861 default_encoder_config_ = config; |
877 return true; | 862 return true; |
878 } | 863 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 | 1037 |
1053 private: | 1038 private: |
1054 std::vector<FakeDataMediaChannel*> channels_; | 1039 std::vector<FakeDataMediaChannel*> channels_; |
1055 std::vector<DataCodec> data_codecs_; | 1040 std::vector<DataCodec> data_codecs_; |
1056 DataChannelType last_channel_type_; | 1041 DataChannelType last_channel_type_; |
1057 }; | 1042 }; |
1058 | 1043 |
1059 } // namespace cricket | 1044 } // namespace cricket |
1060 | 1045 |
1061 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 1046 #endif // TALK_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |