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

Side by Side Diff: content/renderer/media/mock_media_stream_dependency_factory.h

Issue 12086092: Implement audio constraints for PeerConneciton API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove one spa Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 void SetEnded(); 30 void SetEnded();
31 31
32 protected: 32 protected:
33 virtual ~MockVideoSource(); 33 virtual ~MockVideoSource();
34 34
35 private: 35 private:
36 webrtc::ObserverInterface* observer_; 36 webrtc::ObserverInterface* observer_;
37 MediaSourceInterface::SourceState state_; 37 MediaSourceInterface::SourceState state_;
38 }; 38 };
39 39
40 class MockAudioSource : public webrtc::AudioSourceInterface {
41 public:
42 MockAudioSource(const webrtc::MediaConstraintsInterface* constraints);
43
44 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE;
45 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE;
46 virtual MediaSourceInterface::SourceState state() const OVERRIDE;
47
48 // Changes the state of the source to live and notifies the observer.
49 void SetLive();
50 // Changes the state of the source to ended and notifies the observer.
51 void SetEnded();
52
53 const webrtc::MediaConstraintsInterface::Constraints& optional_constraints() {
54 return optional_constraints_;
55 }
56
57 const webrtc::MediaConstraintsInterface::Constraints&
58 mandatory_constraints() {
59 return mandatory_constraints_;
60 }
61
62 protected:
63 virtual ~MockAudioSource();
64
65 private:
66 webrtc::ObserverInterface* observer_;
67 MediaSourceInterface::SourceState state_;
68 webrtc::MediaConstraintsInterface::Constraints optional_constraints_;
69 webrtc::MediaConstraintsInterface::Constraints mandatory_constraints_;
70 };
71
40 class MockLocalVideoTrack : public webrtc::VideoTrackInterface { 72 class MockLocalVideoTrack : public webrtc::VideoTrackInterface {
41 public: 73 public:
42 MockLocalVideoTrack(std::string id, 74 MockLocalVideoTrack(std::string id,
43 webrtc::VideoSourceInterface* source); 75 webrtc::VideoSourceInterface* source);
44 virtual void AddRenderer(webrtc::VideoRendererInterface* renderer) OVERRIDE; 76 virtual void AddRenderer(webrtc::VideoRendererInterface* renderer) OVERRIDE;
45 virtual void RemoveRenderer( 77 virtual void RemoveRenderer(
46 webrtc::VideoRendererInterface* renderer) OVERRIDE; 78 webrtc::VideoRendererInterface* renderer) OVERRIDE;
47 virtual cricket::VideoRenderer* FrameInput() OVERRIDE; 79 virtual cricket::VideoRenderer* FrameInput() OVERRIDE;
48 virtual std::string kind() const OVERRIDE; 80 virtual std::string kind() const OVERRIDE;
49 virtual std::string id() const OVERRIDE; 81 virtual std::string id() const OVERRIDE;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory { 125 class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
94 public: 126 public:
95 MockMediaStreamDependencyFactory(); 127 MockMediaStreamDependencyFactory();
96 virtual ~MockMediaStreamDependencyFactory(); 128 virtual ~MockMediaStreamDependencyFactory();
97 129
98 virtual scoped_refptr<webrtc::PeerConnectionInterface> 130 virtual scoped_refptr<webrtc::PeerConnectionInterface>
99 CreatePeerConnection(const webrtc::JsepInterface::IceServers& ice_servers, 131 CreatePeerConnection(const webrtc::JsepInterface::IceServers& ice_servers,
100 const webrtc::MediaConstraintsInterface* constraints, 132 const webrtc::MediaConstraintsInterface* constraints,
101 WebKit::WebFrame* frame, 133 WebKit::WebFrame* frame,
102 webrtc::PeerConnectionObserver* observer) OVERRIDE; 134 webrtc::PeerConnectionObserver* observer) OVERRIDE;
135 virtual scoped_refptr<webrtc::AudioSourceInterface>
136 CreateLocalAudioSource(
137 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
103 virtual scoped_refptr<webrtc::VideoSourceInterface> 138 virtual scoped_refptr<webrtc::VideoSourceInterface>
104 CreateVideoSource( 139 CreateLocalVideoSource(
105 int video_session_id, 140 int video_session_id,
106 bool is_screencast, 141 bool is_screencast,
107 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE; 142 const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
108 virtual bool InitializeAudioSource( 143 virtual bool InitializeAudioSource(
109 const StreamDeviceInfo& device_info) OVERRIDE; 144 const StreamDeviceInfo& device_info) OVERRIDE;
110 virtual bool CreateWebAudioSource( 145 virtual bool CreateWebAudioSource(
111 WebKit::WebMediaStreamSource* source) OVERRIDE; 146 WebKit::WebMediaStreamSource* source) OVERRIDE;
112 virtual scoped_refptr<webrtc::LocalMediaStreamInterface> 147 virtual scoped_refptr<webrtc::LocalMediaStreamInterface>
113 CreateLocalMediaStream(const std::string& label) OVERRIDE; 148 CreateLocalMediaStream(const std::string& label) OVERRIDE;
114 virtual scoped_refptr<webrtc::VideoTrackInterface> 149 virtual scoped_refptr<webrtc::VideoTrackInterface>
115 CreateLocalVideoTrack(const std::string& id, 150 CreateLocalVideoTrack(const std::string& id,
116 webrtc::VideoSourceInterface* source) OVERRIDE; 151 webrtc::VideoSourceInterface* source) OVERRIDE;
117 virtual scoped_refptr<webrtc::LocalAudioTrackInterface> 152 virtual scoped_refptr<webrtc::LocalAudioTrackInterface>
118 CreateLocalAudioTrack(const std::string& id, 153 CreateLocalAudioTrack(const std::string& id,
119 webrtc::AudioDeviceModule* audio_device) OVERRIDE; 154 webrtc::AudioSourceInterface* source) OVERRIDE;
120 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription( 155 virtual webrtc::SessionDescriptionInterface* CreateSessionDescription(
121 const std::string& type, 156 const std::string& type,
122 const std::string& sdp) OVERRIDE; 157 const std::string& sdp) OVERRIDE;
123 virtual webrtc::IceCandidateInterface* CreateIceCandidate( 158 virtual webrtc::IceCandidateInterface* CreateIceCandidate(
124 const std::string& sdp_mid, 159 const std::string& sdp_mid,
125 int sdp_mline_index, 160 int sdp_mline_index,
126 const std::string& sdp) OVERRIDE; 161 const std::string& sdp) OVERRIDE;
127 162
128 virtual bool EnsurePeerConnectionFactory() OVERRIDE; 163 virtual bool EnsurePeerConnectionFactory() OVERRIDE;
129 virtual bool PeerConnectionFactoryCreated() OVERRIDE; 164 virtual bool PeerConnectionFactoryCreated() OVERRIDE;
130 165
166 MockAudioSource* last_audio_source() { return last_audio_source_; }
131 MockVideoSource* last_video_source() { return last_video_source_; } 167 MockVideoSource* last_video_source() { return last_video_source_; }
132 168
133 private: 169 private:
134 bool mock_pc_factory_created_; 170 bool mock_pc_factory_created_;
171 scoped_refptr <MockAudioSource> last_audio_source_;
135 scoped_refptr <MockVideoSource> last_video_source_; 172 scoped_refptr <MockVideoSource> last_video_source_;
136 173
137 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); 174 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory);
138 }; 175 };
139 176
140 } // namespace content 177 } // namespace content
141 178
142 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ 179 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698