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

Side by Side Diff: content/renderer/media/media_stream_impl.cc

Issue 10534004: Implement CancelUserMediaRequest for the browser part (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed tommi's comments Created 8 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 audio_source_vector); 255 audio_source_vector);
256 WebKit::WebVector<WebKit::WebMediaStreamSource> video_source_vector( 256 WebKit::WebVector<WebKit::WebMediaStreamSource> video_source_vector(
257 video_array.size()); 257 video_array.size());
258 CreateWebKitSourceVector(label, video_array, 258 CreateWebKitSourceVector(label, video_array,
259 WebKit::WebMediaStreamSource::TypeVideo, 259 WebKit::WebMediaStreamSource::TypeVideo,
260 video_source_vector); 260 video_source_vector);
261 261
262 MediaRequestMap::iterator it = user_media_requests_.find(request_id); 262 MediaRequestMap::iterator it = user_media_requests_.find(request_id);
263 if (it == user_media_requests_.end()) { 263 if (it == user_media_requests_.end()) {
264 DVLOG(1) << "Request ID not found"; 264 DVLOG(1) << "Request ID not found";
265 media_stream_dispatcher_->StopStream(label);
265 return; 266 return;
266 } 267 }
267 268
268 LocalNativeStreamPtr native_stream(CreateNativeLocalMediaStream( 269 LocalNativeStreamPtr native_stream(CreateNativeLocalMediaStream(
269 label, it->second.frame_, audio_source_vector, video_source_vector)); 270 label, it->second.frame_, audio_source_vector, video_source_vector));
270 if (!native_stream.get()) { 271 if (!native_stream.get()) {
271 DVLOG(1) << "Failed to create native stream in OnStreamGenerated."; 272 DVLOG(1) << "Failed to create native stream in OnStreamGenerated.";
272 media_stream_dispatcher_->StopStream(label); 273 media_stream_dispatcher_->StopStream(label);
273 it->second.request_.requestFailed(); 274 it->second.request_.requestFailed();
274 user_media_requests_.erase(it); 275 user_media_requests_.erase(it);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 NOTIMPLEMENTED(); 348 NOTIMPLEMENTED();
348 } 349 }
349 350
350 void MediaStreamImpl::OnDeviceOpenFailed(int request_id) { 351 void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {
351 DVLOG(1) << "MediaStreamImpl::VideoDeviceOpenFailed(" 352 DVLOG(1) << "MediaStreamImpl::VideoDeviceOpenFailed("
352 << request_id << ")"; 353 << request_id << ")";
353 NOTIMPLEMENTED(); 354 NOTIMPLEMENTED();
354 } 355 }
355 356
356 void MediaStreamImpl::FrameWillClose(WebKit::WebFrame* frame) { 357 void MediaStreamImpl::FrameWillClose(WebKit::WebFrame* frame) {
358 MediaRequestMap::iterator request_it = user_media_requests_.begin();
359 while (request_it != user_media_requests_.end()) {
360 if (request_it->second.frame_ == frame) {
361 DVLOG(1) << "MediaStreamImpl::FrameWillClose: "
362 << "Cancel user media request " << request_it->first;
363 cancelUserMediaRequest(request_it->second.request_);
364 request_it = user_media_requests_.begin();
365 } else {
366 ++request_it;
367 }
368 }
357 LocalNativeStreamMap::iterator it = local_media_streams_.begin(); 369 LocalNativeStreamMap::iterator it = local_media_streams_.begin();
358 while (it != local_media_streams_.end()) { 370 while (it != local_media_streams_.end()) {
359 if (it->second == frame) { 371 if (it->second == frame) {
360 DVLOG(1) << "MediaStreamImpl::FrameWillClose: " 372 DVLOG(1) << "MediaStreamImpl::FrameWillClose: "
361 << "Stopping stream " << it->first; 373 << "Stopping stream " << it->first;
362 media_stream_dispatcher_->StopStream(it->first); 374 media_stream_dispatcher_->StopStream(it->first);
363 local_media_streams_.erase(it); 375 local_media_streams_.erase(it);
364 it = local_media_streams_.begin(); 376 it = local_media_streams_.begin();
365 } else { 377 } else {
366 ++it; 378 ++it;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 MediaStreamExtraData::MediaStreamExtraData( 581 MediaStreamExtraData::MediaStreamExtraData(
570 webrtc::MediaStreamInterface* remote_stream) 582 webrtc::MediaStreamInterface* remote_stream)
571 : remote_stream_(remote_stream) { 583 : remote_stream_(remote_stream) {
572 } 584 }
573 MediaStreamExtraData::MediaStreamExtraData( 585 MediaStreamExtraData::MediaStreamExtraData(
574 webrtc::LocalMediaStreamInterface* local_stream) 586 webrtc::LocalMediaStreamInterface* local_stream)
575 : local_stream_(local_stream) { 587 : local_stream_(local_stream) {
576 } 588 }
577 MediaStreamExtraData::~MediaStreamExtraData() { 589 MediaStreamExtraData::~MediaStreamExtraData() {
578 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698