| OLD | NEW |
| 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/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 int session_id) { | 204 int session_id) { |
| 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 206 DVLOG(1) << "VideoCaptureController::StopSession, id " << session_id; | 206 DVLOG(1) << "VideoCaptureController::StopSession, id " << session_id; |
| 207 | 207 |
| 208 ControllerClient* client = FindClient(session_id, pending_clients_); | 208 ControllerClient* client = FindClient(session_id, pending_clients_); |
| 209 if (!client) | 209 if (!client) |
| 210 client = FindClient(session_id, controller_clients_); | 210 client = FindClient(session_id, controller_clients_); |
| 211 | 211 |
| 212 if (client) { | 212 if (client) { |
| 213 client->session_closed = true; | 213 client->session_closed = true; |
| 214 client->event_handler->OnPaused(client->controller_id); | 214 client->event_handler->OnEnded(client->controller_id); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 void VideoCaptureController::ReturnBuffer( | 218 void VideoCaptureController::ReturnBuffer( |
| 219 const VideoCaptureControllerID& id, | 219 const VideoCaptureControllerID& id, |
| 220 VideoCaptureControllerEventHandler* event_handler, | 220 VideoCaptureControllerEventHandler* event_handler, |
| 221 int buffer_id) { | 221 int buffer_id) { |
| 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 223 | 223 |
| 224 ControllerClient* client = FindClient(id, event_handler, | 224 ControllerClient* client = FindClient(id, event_handler, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 252 // Implements VideoCaptureDevice::EventHandler. | 252 // Implements VideoCaptureDevice::EventHandler. |
| 253 // OnIncomingCapturedFrame is called the thread running the capture device. | 253 // OnIncomingCapturedFrame is called the thread running the capture device. |
| 254 // I.e.- DirectShow thread on windows and v4l2_thread on Linux. | 254 // I.e.- DirectShow thread on windows and v4l2_thread on Linux. |
| 255 void VideoCaptureController::OnIncomingCapturedFrame( | 255 void VideoCaptureController::OnIncomingCapturedFrame( |
| 256 const uint8* data, | 256 const uint8* data, |
| 257 int length, | 257 int length, |
| 258 base::Time timestamp, | 258 base::Time timestamp, |
| 259 int rotation, | 259 int rotation, |
| 260 bool flip_vert, | 260 bool flip_vert, |
| 261 bool flip_horiz) { | 261 bool flip_horiz) { |
| 262 DCHECK (frame_info_.color == media::VideoCaptureCapability::kI420 || | 262 DCHECK(frame_info_.color == media::VideoCaptureCapability::kI420 || |
| 263 frame_info_.color == media::VideoCaptureCapability::kYV12 || | 263 frame_info_.color == media::VideoCaptureCapability::kYV12 || |
| 264 (rotation == 0 && !flip_vert && !flip_horiz)); | 264 (rotation == 0 && !flip_vert && !flip_horiz)); |
| 265 | 265 |
| 266 scoped_refptr<media::VideoFrame> dst; | 266 scoped_refptr<media::VideoFrame> dst; |
| 267 { | 267 { |
| 268 base::AutoLock lock(buffer_pool_lock_); | 268 base::AutoLock lock(buffer_pool_lock_); |
| 269 if (!buffer_pool_) | 269 if (!buffer_pool_) |
| 270 return; | 270 return; |
| 271 dst = buffer_pool_->ReserveForProducer(rotation); | 271 dst = buffer_pool_->ReserveForProducer(rotation); |
| 272 } | 272 } |
| 273 | 273 |
| 274 if (!dst) | 274 if (!dst) |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 controller_clients_.push_back((*client_it)); | 668 controller_clients_.push_back((*client_it)); |
| 669 pending_clients_.erase(client_it++); | 669 pending_clients_.erase(client_it++); |
| 670 } | 670 } |
| 671 // Request the manager to start the actual capture. | 671 // Request the manager to start the actual capture. |
| 672 video_capture_manager_->Start(current_params_, this); | 672 video_capture_manager_->Start(current_params_, this); |
| 673 state_ = VIDEO_CAPTURE_STATE_STARTED; | 673 state_ = VIDEO_CAPTURE_STATE_STARTED; |
| 674 device_in_use_ = true; | 674 device_in_use_ = true; |
| 675 } | 675 } |
| 676 | 676 |
| 677 } // namespace content | 677 } // namespace content |
| OLD | NEW |