| OLD | NEW |
| 1 // Copyright (c) 2011 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/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 11 #include "content/browser/renderer_host/media/video_capture_manager.h" | 11 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Normal way to stop capture. | 183 // Normal way to stop capture. |
| 184 if (!client->buffers.empty()) { | 184 if (!client->buffers.empty()) { |
| 185 // There are still some buffers held by the client. | 185 // There are still some buffers held by the client. |
| 186 client->report_ready_to_delete = true; | 186 client->report_ready_to_delete = true; |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 // No buffer is held by the client. Ready to delete. | 189 // No buffer is held by the client. Ready to delete. |
| 190 client->event_handler->OnReadyToDelete(client->controller_id); | 190 client->event_handler->OnReadyToDelete(client->controller_id); |
| 191 } | 191 } |
| 192 | 192 |
| 193 int session_id = client->parameters.session_id; |
| 193 delete client; | 194 delete client; |
| 194 controller_clients_.remove(client); | 195 controller_clients_.remove(client); |
| 195 | 196 |
| 196 // No more clients. Stop device. | 197 // No more clients. Stop device. |
| 197 if (controller_clients_.empty()) { | 198 if (controller_clients_.empty()) { |
| 198 video_capture_manager_->Stop(current_params_.session_id, | 199 video_capture_manager_->Stop(session_id, |
| 199 base::Bind(&VideoCaptureController::OnDeviceStopped, this)); | 200 base::Bind(&VideoCaptureController::OnDeviceStopped, this)); |
| 200 frame_info_available_ = false; | 201 frame_info_available_ = false; |
| 201 state_ = video_capture::kStopping; | 202 state_ = video_capture::kStopping; |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 | 205 |
| 205 void VideoCaptureController::ReturnBuffer( | 206 void VideoCaptureController::ReturnBuffer( |
| 206 const VideoCaptureControllerID& id, | 207 const VideoCaptureControllerID& id, |
| 207 VideoCaptureControllerEventHandler* event_handler, | 208 VideoCaptureControllerEventHandler* event_handler, |
| 208 int buffer_id) { | 209 int buffer_id) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 524 } |
| 524 | 525 |
| 525 void VideoCaptureController::DoDeviceStoppedOnIOThread() { | 526 void VideoCaptureController::DoDeviceStoppedOnIOThread() { |
| 526 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 527 device_in_use_ = false; | 528 device_in_use_ = false; |
| 528 if (state_ == video_capture::kStopping) { | 529 if (state_ == video_capture::kStopping) { |
| 529 PostStopping(); | 530 PostStopping(); |
| 530 } | 531 } |
| 531 } | 532 } |
| 532 | 533 |
| OLD | NEW |