| Index: content/renderer/media/media_stream_impl.cc
|
| ===================================================================
|
| --- content/renderer/media/media_stream_impl.cc (revision 118766)
|
| +++ content/renderer/media/media_stream_impl.cc (working copy)
|
| @@ -37,6 +37,9 @@
|
| static const int kVideoCaptureHeight = 288;
|
| static const int kVideoCaptureFramePerSecond = 30;
|
|
|
| +static const int kVideoCaptureWidthLarge = 640;
|
| +static const int kVideoCaptureHeightLarge = 480;
|
| +
|
| } // namespace
|
|
|
| int MediaStreamImpl::next_request_id_ = 0;
|
| @@ -57,6 +60,7 @@
|
| signaling_thread_(NULL),
|
| worker_thread_(NULL),
|
| chrome_worker_thread_("Chrome_libJingle_WorkerThread"),
|
| + desired_size_(0),
|
| vcm_created_(false) {
|
| }
|
|
|
| @@ -77,6 +81,12 @@
|
| }
|
| }
|
|
|
| +void MediaStreamImpl::GetVideoDevice(int size) {
|
| + desired_size_ = size;
|
| + media_stream_dispatcher_->EnumerateDevices(next_request_id_++, this,
|
| + media_stream::kVideoCapture, "");
|
| +}
|
| +
|
| WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
|
| WebKit::WebPeerConnectionHandlerClient* client) {
|
| DCHECK(CalledOnValidThread());
|
| @@ -222,19 +232,7 @@
|
| const GURL& url,
|
| media::MessageLoopFactory* message_loop_factory) {
|
| DCHECK(CalledOnValidThread());
|
| - WebKit::WebMediaStreamDescriptor descriptor(
|
| - WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
|
| - if (descriptor.isNull())
|
| - return NULL; // This is not a valid stream.
|
| - WebKit::WebVector<WebKit::WebMediaStreamSource> source_vector;
|
| - descriptor.sources(source_vector);
|
| - std::string label;
|
| - for (size_t i = 0; i < source_vector.size(); ++i) {
|
| - if (source_vector[i].type() == WebKit::WebMediaStreamSource::TypeVideo) {
|
| - label = UTF16ToUTF8(source_vector[i].id());
|
| - break;
|
| - }
|
| - }
|
| + std::string label = local_label_;
|
| if (label.empty())
|
| return NULL;
|
|
|
| @@ -242,9 +240,18 @@
|
| if (media_stream_dispatcher_->IsStream(label)) {
|
| // It's a local stream.
|
| int video_session_id = media_stream_dispatcher_->video_session_id(label, 0);
|
| +printf("MediaStreamImpl::GetVideoDecoder: use session_id = %d\n", video_session_id);
|
| +
|
| media::VideoCapture::VideoCaptureCapability capability;
|
| - capability.width = kVideoCaptureWidth;
|
| - capability.height = kVideoCaptureHeight;
|
| + if (desired_size_ == 0) {
|
| +printf("MediaStreamImpl::GetVideoDecoder: use small size\n");
|
| + capability.width = kVideoCaptureWidth;
|
| + capability.height = kVideoCaptureHeight;
|
| + } else {
|
| +printf("MediaStreamImpl::GetVideoDecoder: use large size\n");
|
| + capability.width = kVideoCaptureWidthLarge;
|
| + capability.height = kVideoCaptureHeightLarge;
|
| + }
|
| capability.max_fps = kVideoCaptureFramePerSecond;
|
| capability.expected_capture_delay = 0;
|
| capability.raw_type = media::VideoFrame::I420;
|
| @@ -351,6 +358,43 @@
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| +void MediaStreamImpl::OnDevicesEnumerated(
|
| + int request_id,
|
| + const media_stream::StreamDeviceInfoArray& device_array) {
|
| + DVLOG(1) << "MediaStreamImpl::OnDevicesEnumerated("
|
| + << request_id << ")";
|
| + media_stream::StreamDeviceInfoArray::const_iterator it;
|
| + for (it = device_array.begin(); it != device_array.end(); it++) {
|
| + }
|
| + if (!device_array.empty()) {
|
| + media_stream_dispatcher_->OpenDevice(
|
| + next_request_id_++, this,
|
| + device_array[0].device_id,
|
| + media_stream::kVideoCapture, "");
|
| + }
|
| +}
|
| +
|
| +void MediaStreamImpl::OnDevicesEnumerationFailed(int request_id) {
|
| + DVLOG(1) << "MediaStreamImpl::OnDevicesEnumerationFailed("
|
| + << request_id << ")";
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| +void MediaStreamImpl::OnDeviceOpened(
|
| + int request_id,
|
| + const std::string& label,
|
| + const media_stream::StreamDeviceInfo& video_device) {
|
| + DVLOG(1) << "MediaStreamImpl::OnDeviceOpened("
|
| + << request_id << ", " << label << ")";
|
| + local_label_ = label;
|
| +}
|
| +
|
| +void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {
|
| + DVLOG(1) << "MediaStreamImpl::VideoDeviceOpenFailed("
|
| + << request_id << ")";
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| void MediaStreamImpl::InitializeWorkerThread(talk_base::Thread** thread,
|
| base::WaitableEvent* event) {
|
| jingle_glue::JingleThreadWrapper::EnsureForCurrentThread();
|
|
|