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

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

Issue 8480028: support video device enumeration from renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: simplify interface between MSManager and MSDevieSettings Created 9 years, 1 month 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
« no previous file with comments | « content/renderer/media/media_stream_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_impl.cc
===================================================================
--- content/renderer/media/media_stream_impl.cc (revision 109718)
+++ content/renderer/media/media_stream_impl.cc (working copy)
@@ -6,6 +6,7 @@
#include "base/string_util.h"
#include "content/renderer/media/capture_video_decoder.h"
+#include "content/renderer/media/media_stream_dispatcher.h"
#include "content/renderer/media/video_capture_impl_manager.h"
#include "googleurl/src/gurl.h"
#include "media/base/message_loop_factory.h"
@@ -22,18 +23,32 @@
// TODO(wjia): remove this string when full media stream code is checked in.
static const char kRawMediaScheme[] = "mediastream";
+static int desired_device_index = 0;
+static int next_request_id = 1;
+
} // namespace
-MediaStreamImpl::MediaStreamImpl(VideoCaptureImplManager* vc_manager)
- : vc_manager_(vc_manager) {
+MediaStreamImpl::MediaStreamImpl(
+ MediaStreamDispatcher* media_stream_dispatcher,
+ VideoCaptureImplManager* vc_manager)
+ : media_stream_dispatcher_(media_stream_dispatcher),
+ vc_manager_(vc_manager) {
}
MediaStreamImpl::~MediaStreamImpl() {}
+void MediaStreamImpl::GetVideoDevice(int index) {
+ desired_device_index = index;
+ media_stream_dispatcher_->EnumerateVideoDevices(next_request_id++, this, "");
+}
+
scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder(
const GURL& url, media::MessageLoopFactory* message_loop_factory) {
bool raw_media = (url.spec().find(kRawMediaScheme) == 0);
media::VideoDecoder* decoder = NULL;
+ int session_id = media_stream_dispatcher_->video_session_id(local_label_, 0);
+ if (session_id == media_stream::StreamDeviceInfo::kNoId)
+ session_id = kStartOpenSessionId;
if (raw_media) {
media::VideoCapture::VideoCaptureCapability capability;
capability.width = kVideoCaptureWidth;
@@ -45,7 +60,74 @@
decoder = new CaptureVideoDecoder(
message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(),
- kStartOpenSessionId, vc_manager_.get(), capability);
+ session_id, vc_manager_.get(), capability);
}
return decoder;
}
+
+void MediaStreamImpl::OnStreamGenerated(
+ int request_id,
+ const std::string& label,
+ const media_stream::StreamDeviceInfoArray& audio_array,
+ const media_stream::StreamDeviceInfoArray& video_array) {
+ DVLOG(1) << "MediaStreamImpl::OnStreamGenerated("
+ << request_id << ", " << label << ")";
+ NOTIMPLEMENTED();
+}
+
+void MediaStreamImpl::OnStreamGenerationFailed(int request_id) {
+ DVLOG(1) << "MediaStreamImpl::OnStreamGenerationFailed("
+ << request_id << ")";
+ NOTIMPLEMENTED();
+}
+
+void MediaStreamImpl::OnVideoDeviceFailed(const std::string& label,
+ int index) {
+ DVLOG(1) << "MediaStreamImpl::OnVideoDeviceFailed("
+ << label << ", " << index << ")";
+ NOTIMPLEMENTED();
+}
+
+void MediaStreamImpl::OnAudioDeviceFailed(const std::string& label,
+ int index) {
+ DVLOG(1) << "MediaStreamImpl::OnAudioDeviceFailed("
+ << label << ", " << index << ")";
+ NOTIMPLEMENTED();
+}
+
+void MediaStreamImpl::OnVideoDevicesEnumerated(
+ int request_id,
+ const media_stream::StreamDeviceInfoArray& device_array) {
+ DVLOG(1) << "MediaStreamImpl::OnVideoDevicesEnumerated("
+ << request_id << ")";
+ media_stream::StreamDeviceInfoArray::const_iterator it;
+ for (it = device_array.begin(); it != device_array.end(); it++) {
+ }
+ if (desired_device_index < static_cast<int>(device_array.size())) {
+ media_stream_dispatcher_->OpenVideoDevice(
+ next_request_id++, this,
+ device_array[desired_device_index].device_id, "");
+ }
+}
+
+void MediaStreamImpl::OnVideoDevicesEnumerationFailed(int request_id) {
+ DVLOG(1) << "MediaStreamImpl::OnVideoDevicesEnumerationFailed("
+ << request_id << ")";
+ NOTIMPLEMENTED();
+}
+
+void MediaStreamImpl::OnVideoDeviceOpened(
+ int request_id,
+ const std::string& label,
+ const media_stream::StreamDeviceInfo& video_device) {
+ DVLOG(1) << "MediaStreamImpl::OnVideoDeviceOpened("
+ << request_id << ", " << label << ")";
+ local_label_ = label;
+}
+
+void MediaStreamImpl::OnVideoDeviceOpenFailed(int request_id) {
+ DVLOG(1) << "MediaStreamImpl::VideoDeviceOpenFailed("
+ << request_id << ")";
+ NOTIMPLEMENTED();
+}
+
« no previous file with comments | « content/renderer/media/media_stream_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698