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

Unified Diff: content/renderer/media/mock_media_stream_dependency_factory.cc

Issue 9284020: Enabling usage of native PeerConnection v2 in libjingle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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.cc
diff --git a/content/renderer/media/mock_media_stream_dependency_factory.cc b/content/renderer/media/mock_media_stream_dependency_factory.cc
index 5cbcbd4118c0dce83fe842726dbda0ffeb3577ff..94ebe3e0b055e02de3ddeaec6f369faa8047ddba 100644
--- a/content/renderer/media/mock_media_stream_dependency_factory.cc
+++ b/content/renderer/media/mock_media_stream_dependency_factory.cc
@@ -5,28 +5,119 @@
#include "base/logging.h"
#include "content/renderer/media/mock_media_stream_dependency_factory.h"
#include "content/renderer/media/mock_peer_connection_impl.h"
+#include "third_party/libjingle/source/talk/app/webrtc/mediastream.h"
+#include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h"
#include "third_party/libjingle/source/talk/session/phone/webrtcmediaengine.h"
+namespace webrtc {
+
+class MockLocalVideoTrack : public LocalVideoTrackInterface {
+ public:
+ virtual cricket::VideoCapturer* GetVideoCapture() OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+ virtual void SetRenderer(VideoRendererWrapperInterface* renderer) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+ virtual VideoRendererWrapperInterface* GetRenderer() OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+ virtual std::string kind() const OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
tommi (sloooow) - chröme 2012/01/24 15:18:56 don't you mean ""?
Henrik Grunell 2012/01/26 13:03:16 Yes, copy paste miss. Fixed.
+ }
+ virtual std::string label() const OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
tommi (sloooow) - chröme 2012/01/24 15:18:56 and here
Henrik Grunell 2012/01/26 13:03:16 Done.
+ }
+ virtual bool enabled() const OVERRIDE {
+ NOTIMPLEMENTED();
+ return true;
+ }
+ virtual TrackState state() const OVERRIDE {
+ NOTIMPLEMENTED();
+ return kInitializing;
+ }
+ virtual bool set_enabled(bool enable) OVERRIDE {
+ NOTIMPLEMENTED();
+ return false;
+ }
+ virtual bool set_state(TrackState new_state) OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
tommi (sloooow) - chröme 2012/01/24 15:18:56 false?
Henrik Grunell 2012/01/26 13:03:16 Yes, fixed.
+ }
+ virtual void RegisterObserver(ObserverInterface* observer) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+ virtual void UnregisterObserver(ObserverInterface* observer) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+
+ protected:
+ virtual ~MockLocalVideoTrack() {}
+};
+
+// TODO(grunell): BEFORE COMMIT. Audio track impl.
+
+class MockLocalMediaStream : public LocalMediaStreamInterface {
+ public:
+ virtual bool AddTrack(AudioTrackInterface* track) OVERRIDE {
+ NOTIMPLEMENTED();
+ return false;
+ }
+ virtual bool AddTrack(VideoTrackInterface* track) OVERRIDE {
+ NOTIMPLEMENTED();
+ return false;
+ }
+ virtual std::string label() const OVERRIDE { return label_; }
tommi (sloooow) - chröme 2012/01/24 15:18:56 should the label() accessor return const std::stri
Henrik Grunell 2012/01/26 13:03:16 The base class is not ours, can't change that.
+ virtual AudioTracks* audio_tracks() OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+ virtual VideoTracks* video_tracks() OVERRIDE {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+ virtual ReadyState ready_state() OVERRIDE {
+ NOTIMPLEMENTED();
+ return kInitializing;
+ }
+ virtual void set_ready_state(ReadyState state) OVERRIDE { NOTIMPLEMENTED(); }
+ virtual void RegisterObserver(ObserverInterface* observer) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
+ virtual void UnregisterObserver(ObserverInterface* observer) {
+ NOTIMPLEMENTED();
+ }
+
+ protected:
+ virtual ~MockLocalMediaStream() {}
+
+ private:
+ std::string label_;
+};
+
+} // namespace webrtc
+
MockMediaStreamDependencyFactory::MockMediaStreamDependencyFactory()
: mock_pc_factory_created_(false) {
}
MockMediaStreamDependencyFactory::~MockMediaStreamDependencyFactory() {}
-cricket::WebRtcMediaEngine*
-MockMediaStreamDependencyFactory::CreateWebRtcMediaEngine() {
- return new cricket::WebRtcMediaEngine(NULL, NULL, NULL);
-}
-
bool MockMediaStreamDependencyFactory::CreatePeerConnectionFactory(
- cricket::MediaEngineInterface* media_engine,
- talk_base::Thread* worker_thread) {
+ talk_base::Thread* worker_thread,
+ talk_base::Thread* signaling_thread,
+ content::P2PSocketDispatcher* socket_dispatcher,
+ talk_base::NetworkManager* network_manager,
+ talk_base::PacketSocketFactory* socket_factory) {
mock_pc_factory_created_ = true;
- media_engine_.reset(media_engine);
return true;
}
-void MockMediaStreamDependencyFactory::DeletePeerConnectionFactory() {
+void MockMediaStreamDependencyFactory::ReleasePeerConnectionFactory() {
mock_pc_factory_created_ = false;
}
@@ -34,17 +125,39 @@ bool MockMediaStreamDependencyFactory::PeerConnectionFactoryCreated() {
return mock_pc_factory_created_;
}
-cricket::PortAllocator* MockMediaStreamDependencyFactory::CreatePortAllocator(
- content::P2PSocketDispatcher* socket_dispatcher,
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
- const webkit_glue::P2PTransport::Config& config) {
+talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
tommi (sloooow) - chröme 2012/01/24 15:18:56 add the same 'using' lines for these types so that
Henrik Grunell 2012/01/26 13:03:16 Same comment. No change.
+MockMediaStreamDependencyFactory::CreatePeerConnection(
tommi (sloooow) - chröme 2012/01/24 15:18:56 fix indentation here
Henrik Grunell 2012/01/26 13:03:16 Done.
+ const std::string& config,
+ webrtc::PeerConnectionObserver* observer) {
+ DCHECK(mock_pc_factory_created_);
+ // TODO(grunell): BEFORE COMMIT. Implement.
+ // return new webrtc::MockPeerConnectionImpl();
+ NOTIMPLEMENTED();
return NULL;
}
-webrtc::PeerConnection* MockMediaStreamDependencyFactory::CreatePeerConnection(
- cricket::PortAllocator* port_allocator,
- talk_base::Thread* signaling_thread) {
- DCHECK(mock_pc_factory_created_);
- return new webrtc::MockPeerConnectionImpl();
+talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface>
+MockMediaStreamDependencyFactory::CreateLocalMediaStream(
+ const std::string& label) {
+ talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> stream(
+ new talk_base::RefCountedObject<webrtc::MockLocalMediaStream>());
+ return stream;
+}
+
+talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface>
+MockMediaStreamDependencyFactory::CreateLocalVideoTrack(
+ const std::string& label,
+ cricket::VideoCapturer* video_device) {
+ talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> stream(
+ new talk_base::RefCountedObject<webrtc::MockLocalVideoTrack>());
+ return stream;
+}
+
+talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface>
+MockMediaStreamDependencyFactory::CreateLocalAudioTrack(
+ const std::string& label,
+ webrtc::AudioDeviceModule* audio_device) {
+ // TODO(grunell): BEFORE COMMIT. Implement.
+ NOTIMPLEMENTED();
+ return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698