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

Side by Side 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: '' Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/renderer/media/media_stream_impl.h" 5 #include "content/renderer/media/media_stream_impl.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "content/renderer/media/capture_video_decoder.h" 8 #include "content/renderer/media/capture_video_decoder.h"
9 #include "content/renderer/media/media_stream_dispatcher.h"
9 #include "content/renderer/media/video_capture_impl_manager.h" 10 #include "content/renderer/media/video_capture_impl_manager.h"
10 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
11 #include "media/base/message_loop_factory.h" 12 #include "media/base/message_loop_factory.h"
12 #include "media/base/pipeline.h" 13 #include "media/base/pipeline.h"
13 14
14 namespace { 15 namespace {
15 16
16 static const int kVideoCaptureWidth = 352; 17 static const int kVideoCaptureWidth = 352;
17 static const int kVideoCaptureHeight = 288; 18 static const int kVideoCaptureHeight = 288;
18 static const int kVideoCaptureFramePerSecond = 30; 19 static const int kVideoCaptureFramePerSecond = 30;
19 20
20 static const int kStartOpenSessionId = 1; 21 static const int kStartOpenSessionId = 1;
21 22
22 // TODO(wjia): remove this string when full media stream code is checked in. 23 // TODO(wjia): remove this string when full media stream code is checked in.
23 static const char kRawMediaScheme[] = "mediastream"; 24 static const char kRawMediaScheme[] = "mediastream";
24 25
25 } // namespace 26 } // namespace
26 27
27 MediaStreamImpl::MediaStreamImpl(VideoCaptureImplManager* vc_manager) 28 MediaStreamImpl::MediaStreamImpl(
28 : vc_manager_(vc_manager) { 29 MediaStreamDispatcher* media_stream_dispatcher,
30 VideoCaptureImplManager* vc_manager)
31 : media_stream_dispatcher_(media_stream_dispatcher),
32 vc_manager_(vc_manager) {
33 DCHECK(media_stream_dispatcher);
29 } 34 }
30 35
31 MediaStreamImpl::~MediaStreamImpl() {} 36 MediaStreamImpl::~MediaStreamImpl() {}
32 37
33 scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder( 38 scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder(
34 const GURL& url, media::MessageLoopFactory* message_loop_factory) { 39 const GURL& url, media::MessageLoopFactory* message_loop_factory) {
35 bool raw_media = (url.spec().find(kRawMediaScheme) == 0); 40 bool raw_media = (url.spec().find(kRawMediaScheme) == 0);
36 media::VideoDecoder* decoder = NULL; 41 media::VideoDecoder* decoder = NULL;
42 int session_id = media_stream_dispatcher_->video_session_id(local_label_, 0);
43 if (session_id == media_stream::StreamDeviceInfo::kNoId)
44 session_id = kStartOpenSessionId;
37 if (raw_media) { 45 if (raw_media) {
38 media::VideoCapture::VideoCaptureCapability capability; 46 media::VideoCapture::VideoCaptureCapability capability;
39 capability.width = kVideoCaptureWidth; 47 capability.width = kVideoCaptureWidth;
40 capability.height = kVideoCaptureHeight; 48 capability.height = kVideoCaptureHeight;
41 capability.max_fps = kVideoCaptureFramePerSecond; 49 capability.max_fps = kVideoCaptureFramePerSecond;
42 capability.expected_capture_delay = 0; 50 capability.expected_capture_delay = 0;
43 capability.raw_type = media::VideoFrame::I420; 51 capability.raw_type = media::VideoFrame::I420;
44 capability.interlaced = false; 52 capability.interlaced = false;
45 53
46 decoder = new CaptureVideoDecoder( 54 decoder = new CaptureVideoDecoder(
47 message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(), 55 message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(),
48 kStartOpenSessionId, vc_manager_.get(), capability); 56 session_id, vc_manager_.get(), capability);
49 } 57 }
50 return decoder; 58 return decoder;
51 } 59 }
60
61 void MediaStreamImpl::OnStreamGenerated(
62 int request_id,
63 const std::string& label,
64 const media_stream::StreamDeviceInfoArray& audio_array,
65 const media_stream::StreamDeviceInfoArray& video_array) {
66 DVLOG(1) << "MediaStreamImpl::OnStreamGenerated("
67 << request_id << ", " << label << ")";
68 NOTIMPLEMENTED();
69 }
70
71 void MediaStreamImpl::OnStreamGenerationFailed(int request_id) {
72 DVLOG(1) << "MediaStreamImpl::OnStreamGenerationFailed("
73 << request_id << ")";
74 NOTIMPLEMENTED();
75 }
76
77 void MediaStreamImpl::OnVideoDeviceFailed(const std::string& label,
78 int index) {
79 DVLOG(1) << "MediaStreamImpl::OnVideoDeviceFailed("
80 << label << ", " << index << ")";
81 NOTIMPLEMENTED();
82 }
83
84 void MediaStreamImpl::OnAudioDeviceFailed(const std::string& label,
85 int index) {
86 DVLOG(1) << "MediaStreamImpl::OnAudioDeviceFailed("
87 << label << ", " << index << ")";
88 NOTIMPLEMENTED();
89 }
90
91 void MediaStreamImpl::OnVideoDevicesEnumerated(
92 int request_id,
93 const media_stream::StreamDeviceInfoArray& device_array) {
94 DVLOG(1) << "MediaStreamImpl::OnVideoDevicesEnumerated("
95 << request_id << ")";
96 NOTIMPLEMENTED();
97 }
98
99 void MediaStreamImpl::OnVideoDevicesEnumerationFailed(int request_id) {
100 DVLOG(1) << "MediaStreamImpl::OnVideoDevicesEnumerationFailed("
101 << request_id << ")";
102 NOTIMPLEMENTED();
103 }
104
105 void MediaStreamImpl::OnVideoDeviceOpened(
106 int request_id,
107 const std::string& label,
108 const media_stream::StreamDeviceInfo& video_device) {
109 DVLOG(1) << "MediaStreamImpl::OnVideoDeviceOpened("
110 << request_id << ", " << label << ")";
111 NOTIMPLEMENTED();
112 }
113
114 void MediaStreamImpl::OnVideoDeviceOpenFailed(int request_id) {
115 DVLOG(1) << "MediaStreamImpl::VideoDeviceOpenFailed("
116 << request_id << ")";
117 NOTIMPLEMENTED();
118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698