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

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

Issue 10912004: Begin adding support for tab mirroring via the MediaStream audio/video capturing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 8 years, 3 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_dispatcher.cc
diff --git a/content/renderer/media/mock_media_stream_dispatcher.cc b/content/renderer/media/mock_media_stream_dispatcher.cc
index 5bad676b92529f0c3fd4a57e467cda7a0b90485b..288bcef80943875c0dc8269db0cdac01c113f643 100644
--- a/content/renderer/media/mock_media_stream_dispatcher.cc
+++ b/content/renderer/media/mock_media_stream_dispatcher.cc
@@ -5,6 +5,7 @@
#include "content/renderer/media/mock_media_stream_dispatcher.h"
#include "base/stringprintf.h"
+#include "content/public/common/media_stream_request.h"
MockMediaStreamDispatcher::MockMediaStreamDispatcher()
: MediaStreamDispatcher(NULL),
@@ -25,19 +26,49 @@ void MockMediaStreamDispatcher::GenerateStream(
audio_array_.clear();
video_array_.clear();
- if (components.audio) {
+ if (content::IsAudioMediaType(components.audio_type)) {
media_stream::StreamDeviceInfo audio;
- audio.device_id= "audio_device_id";
- audio.name ="audio microphone";
- audio.stream_type = content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE;
+ audio.device_id = "audio_device_id";
+ audio.name = "microphone";
+ audio.stream_type = components.audio_type;
audio.session_id = request_id;
audio_array_.push_back(audio);
}
- if (components.video) {
+ if (content::IsVideoMediaType(components.video_type)) {
media_stream::StreamDeviceInfo video;
- video.device_id= "video_device_id";
- video.name ="usb video camera";
- video.stream_type = content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE;
+ video.device_id = "video_device_id";
+ video.name = "usb video camera";
+ video.stream_type = components.video_type;
+ video.session_id = request_id;
+ video_array_.push_back(video);
+ }
+}
+
+void MockMediaStreamDispatcher::GenerateStreamForDevice(
+ int request_id,
+ const base::WeakPtr<MediaStreamDispatcherEventHandler>&,
+ media_stream::StreamOptions components,
+ const std::string& device_id,
+ const GURL&) {
+ request_id_ = request_id;
+
+ stream_label_ = StringPrintf("%s%d","local_stream",request_id);
+ audio_array_.clear();
+ video_array_.clear();
+
+ if (content::IsAudioMediaType(components.audio_type)) {
+ media_stream::StreamDeviceInfo audio;
+ audio.device_id = device_id;
+ audio.name = "Tab Audio Capture";
+ audio.stream_type = components.audio_type;
+ audio.session_id = request_id;
+ audio_array_.push_back(audio);
+ }
+ if (content::IsVideoMediaType(components.video_type)) {
+ media_stream::StreamDeviceInfo video;
+ video.device_id = device_id;
+ video.name = "Tab Video Capture";
+ video.stream_type = components.video_type;
video.session_id = request_id;
video_array_.push_back(video);
}

Powered by Google App Engine
This is Rietveld 408576698