| OLD | NEW |
| 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/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
| 9 #include "content/browser/renderer_host/media/video_capture_manager.h" | 9 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 10 #include "media/base/yuv_convert.h" | 10 #include "media/base/yuv_convert.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 default: | 148 default: |
| 149 NOTREACHED(); | 149 NOTREACHED(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 event_handler_->OnBufferReady(id_, buffer_id, timestamp); | 152 event_handler_->OnBufferReady(id_, buffer_id, timestamp); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void VideoCaptureController::OnError() { | 155 void VideoCaptureController::OnError() { |
| 156 event_handler_->OnError(id_); | 156 event_handler_->OnError(id_); |
| 157 media_stream::VideoCaptureManager::Get()->Error(params_.session_id); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void VideoCaptureController::OnFrameInfo( | 160 void VideoCaptureController::OnFrameInfo( |
| 160 const media::VideoCaptureDevice::Capability& info) { | 161 const media::VideoCaptureDevice::Capability& info) { |
| 161 DCHECK(owned_dibs_.empty()); | 162 DCHECK(owned_dibs_.empty()); |
| 162 bool frames_created = true; | 163 bool frames_created = true; |
| 163 const size_t needed_size = (info.width * info.height * 3) / 2; | 164 const size_t needed_size = (info.width * info.height * 3) / 2; |
| 164 for (size_t i = 1; i <= kNoOfDIBS; ++i) { | 165 for (size_t i = 1; i <= kNoOfDIBS; ++i) { |
| 165 base::SharedMemory* shared_memory = new base::SharedMemory(); | 166 base::SharedMemory* shared_memory = new base::SharedMemory(); |
| 166 if (!shared_memory->CreateAndMapAnonymous(needed_size)) { | 167 if (!shared_memory->CreateAndMapAnonymous(needed_size)) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 202 } |
| 202 | 203 |
| 203 if (ready_to_delete_now) { | 204 if (ready_to_delete_now) { |
| 204 event_handler_->OnReadyToDelete(id_); | 205 event_handler_->OnReadyToDelete(id_); |
| 205 } | 206 } |
| 206 if (stopped_task) { | 207 if (stopped_task) { |
| 207 stopped_task->Run(); | 208 stopped_task->Run(); |
| 208 delete stopped_task; | 209 delete stopped_task; |
| 209 } | 210 } |
| 210 } | 211 } |
| OLD | NEW |