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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/mock_media_stream_dependency_factory.h
diff --git a/content/renderer/media/mock_media_stream_dependency_factory.h b/content/renderer/media/mock_media_stream_dependency_factory.h
index ca11a797edf836f5d75b44eba040234a992849f1..c2c6d96721ee002c4f113285974dfbb09565665b 100644
--- a/content/renderer/media/mock_media_stream_dependency_factory.h
+++ b/content/renderer/media/mock_media_stream_dependency_factory.h
@@ -37,6 +37,38 @@ class MockVideoSource : public webrtc::VideoSourceInterface {
MediaSourceInterface::SourceState state_;
};
+class MockAudioSource : public webrtc::AudioSourceInterface {
+ public:
+ MockAudioSource(const webrtc::MediaConstraintsInterface* constraints);
+
+ virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE;
+ virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE;
+ virtual MediaSourceInterface::SourceState state() const OVERRIDE;
+
+ // Changes the state of the source to live and notifies the observer.
+ void SetLive();
+ // Changes the state of the source to ended and notifies the observer.
+ void SetEnded();
+
+ const webrtc::MediaConstraintsInterface::Constraints& optional_constraints() {
+ return optional_constraints_;
+ }
+
+ const webrtc::MediaConstraintsInterface::Constraints&
+ mandatory_constraints() {
+ return mandatory_constraints_;
+ }
+
+ protected:
+ virtual ~MockAudioSource();
+
+ private:
+ webrtc::ObserverInterface* observer_;
+ MediaSourceInterface::SourceState state_;
+ webrtc::MediaConstraintsInterface::Constraints optional_constraints_;
+ webrtc::MediaConstraintsInterface::Constraints mandatory_constraints_;
+};
+
class MockLocalVideoTrack : public webrtc::VideoTrackInterface {
public:
MockLocalVideoTrack(std::string id,
@@ -100,8 +132,11 @@ class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
const webrtc::MediaConstraintsInterface* constraints,
WebKit::WebFrame* frame,
webrtc::PeerConnectionObserver* observer) OVERRIDE;
+ virtual scoped_refptr<webrtc::AudioSourceInterface>
+ CreateLocalAudioSource(
+ const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
virtual scoped_refptr<webrtc::VideoSourceInterface>
- CreateVideoSource(
+ CreateLocalVideoSource(
int video_session_id,
bool is_screencast,
const webrtc::MediaConstraintsInterface* constraints) OVERRIDE;
@@ -116,7 +151,7 @@ class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
webrtc::VideoSourceInterface* source) OVERRIDE;
virtual scoped_refptr<webrtc::LocalAudioTrackInterface>
CreateLocalAudioTrack(const std::string& id,
- webrtc::AudioDeviceModule* audio_device) OVERRIDE;
+ webrtc::AudioSourceInterface* source) OVERRIDE;
virtual webrtc::SessionDescriptionInterface* CreateSessionDescription(
const std::string& type,
const std::string& sdp) OVERRIDE;
@@ -128,10 +163,12 @@ class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
virtual bool EnsurePeerConnectionFactory() OVERRIDE;
virtual bool PeerConnectionFactoryCreated() OVERRIDE;
+ MockAudioSource* last_audio_source() { return last_audio_source_; }
MockVideoSource* last_video_source() { return last_video_source_; }
private:
bool mock_pc_factory_created_;
+ scoped_refptr <MockAudioSource> last_audio_source_;
scoped_refptr <MockVideoSource> last_video_source_;
DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory);

Powered by Google App Engine
This is Rietveld 408576698