Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: webrtc/media/base/fakemediaengine.h

Issue 2948763002: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: tracking linux32_rel issue Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 11 #ifndef WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 12 #define WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
13 13
14 #include <list> 14 #include <list>
15 #include <map> 15 #include <map>
16 #include <memory> 16 #include <memory>
17 #include <set> 17 #include <set>
18 #include <string> 18 #include <string>
19 #include <vector> 19 #include <vector>
20 20
21 #include "webrtc/api/call/audio_sink.h" 21 #include "webrtc/api/call/audio_sink.h"
22 #include "webrtc/base/checks.h" 22 #include "webrtc/base/checks.h"
23 #include "webrtc/base/copyonwritebuffer.h" 23 #include "webrtc/base/copyonwritebuffer.h"
24 #include "webrtc/base/networkroute.h" 24 #include "webrtc/base/networkroute.h"
25 #include "webrtc/base/stringutils.h" 25 #include "webrtc/base/stringutils.h"
26 #include "webrtc/media/base/audiosource.h" 26 #include "webrtc/media/base/audiosource.h"
27 #include "webrtc/media/base/mediaengine.h" 27 #include "webrtc/media/base/mediaengine.h"
28 #include "webrtc/media/base/rtputils.h" 28 #include "webrtc/media/base/rtputils.h"
29 #include "webrtc/media/base/streamparams.h" 29 #include "webrtc/media/base/streamparams.h"
30 #include "webrtc/modules/audio_processing/include/audio_processing.h"
30 #include "webrtc/p2p/base/sessiondescription.h" 31 #include "webrtc/p2p/base/sessiondescription.h"
31 32
32 using webrtc::RtpExtension; 33 using webrtc::RtpExtension;
33 34
34 namespace cricket { 35 namespace cricket {
35 36
36 class FakeMediaEngine; 37 class FakeMediaEngine;
37 class FakeVideoEngine; 38 class FakeVideoEngine;
38 class FakeVoiceEngine; 39 class FakeVoiceEngine;
39 40
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 RtpCapabilities capabilities_; 768 RtpCapabilities capabilities_;
768 }; 769 };
769 770
770 class FakeVoiceEngine : public FakeBaseEngine { 771 class FakeVoiceEngine : public FakeBaseEngine {
771 public: 772 public:
772 FakeVoiceEngine(webrtc::AudioDeviceModule* adm, 773 FakeVoiceEngine(webrtc::AudioDeviceModule* adm,
773 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& 774 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
774 audio_encoder_factory, 775 audio_encoder_factory,
775 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& 776 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
776 audio_decoder_factory, 777 audio_decoder_factory,
777 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) { 778 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
779 rtc::scoped_refptr<webrtc::AudioProcessing> apm) {
778 // Add a fake audio codec. Note that the name must not be "" as there are 780 // Add a fake audio codec. Note that the name must not be "" as there are
779 // sanity checks against that. 781 // sanity checks against that.
780 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1)); 782 codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1));
781 } 783 }
782 void Init() {} 784 void Init() {}
783 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { 785 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const {
784 return rtc::scoped_refptr<webrtc::AudioState>(); 786 return rtc::scoped_refptr<webrtc::AudioState>();
785 } 787 }
786 788
787 VoiceMediaChannel* CreateChannel(webrtc::Call* call, 789 VoiceMediaChannel* CreateChannel(webrtc::Call* call,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 friend class FakeMediaEngine; 880 friend class FakeMediaEngine;
879 }; 881 };
880 882
881 class FakeMediaEngine : 883 class FakeMediaEngine :
882 public CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine> { 884 public CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine> {
883 public: 885 public:
884 FakeMediaEngine() 886 FakeMediaEngine()
885 : CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine>(nullptr, 887 : CompositeMediaEngine<FakeVoiceEngine, FakeVideoEngine>(nullptr,
886 nullptr, 888 nullptr,
887 nullptr, 889 nullptr,
890 nullptr,
888 nullptr) {} 891 nullptr) {}
889 virtual ~FakeMediaEngine() {} 892 virtual ~FakeMediaEngine() {}
890 893
891 void SetAudioCodecs(const std::vector<AudioCodec>& codecs) { 894 void SetAudioCodecs(const std::vector<AudioCodec>& codecs) {
892 voice_.SetCodecs(codecs); 895 voice_.SetCodecs(codecs);
893 } 896 }
894 void SetVideoCodecs(const std::vector<VideoCodec>& codecs) { 897 void SetVideoCodecs(const std::vector<VideoCodec>& codecs) {
895 video_.SetCodecs(codecs); 898 video_.SetCodecs(codecs);
896 } 899 }
897 900
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } 974 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; }
972 975
973 private: 976 private:
974 std::vector<FakeDataMediaChannel*> channels_; 977 std::vector<FakeDataMediaChannel*> channels_;
975 std::vector<DataCodec> data_codecs_; 978 std::vector<DataCodec> data_codecs_;
976 }; 979 };
977 980
978 } // namespace cricket 981 } // namespace cricket
979 982
980 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 983 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698