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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 void VideoCaptureController::DoFrameInfoOnIOThread() { | 561 void VideoCaptureController::DoFrameInfoOnIOThread() { |
562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
563 DCHECK(!buffer_pool_.get()) | 563 DCHECK(!buffer_pool_.get()) |
564 << "Device is restarted without releasing shared memory."; | 564 << "Device is restarted without releasing shared memory."; |
565 | 565 |
566 // Allocate memory only when device has been started. | 566 // Allocate memory only when device has been started. |
567 if (state_ != VIDEO_CAPTURE_STATE_STARTED) | 567 if (state_ != VIDEO_CAPTURE_STATE_STARTED) |
568 return; | 568 return; |
569 | 569 |
570 scoped_refptr<VideoCaptureBufferPool> buffer_pool = | 570 scoped_refptr<VideoCaptureBufferPool> buffer_pool = |
571 new VideoCaptureBufferPool(frame_info_.width * frame_info_.height * 3 / 2, | 571 new VideoCaptureBufferPool( |
572 kNoOfBuffers); | 572 media::VideoFrame::AllocationSize( |
| 573 media::VideoFrame::I420, |
| 574 gfx::Size(frame_info_.width, frame_info_.height)), |
| 575 kNoOfBuffers); |
573 | 576 |
574 // Check whether all buffers were created successfully. | 577 // Check whether all buffers were created successfully. |
575 if (!buffer_pool->Allocate()) { | 578 if (!buffer_pool->Allocate()) { |
576 state_ = VIDEO_CAPTURE_STATE_ERROR; | 579 state_ = VIDEO_CAPTURE_STATE_ERROR; |
577 for (ControllerClients::iterator client_it = controller_clients_.begin(); | 580 for (ControllerClients::iterator client_it = controller_clients_.begin(); |
578 client_it != controller_clients_.end(); ++client_it) { | 581 client_it != controller_clients_.end(); ++client_it) { |
579 (*client_it)->event_handler->OnError((*client_it)->controller_id); | 582 (*client_it)->event_handler->OnError((*client_it)->controller_id); |
580 } | 583 } |
581 return; | 584 return; |
582 } | 585 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 controller_clients_.push_back((*client_it)); | 721 controller_clients_.push_back((*client_it)); |
719 pending_clients_.erase(client_it++); | 722 pending_clients_.erase(client_it++); |
720 } | 723 } |
721 // Request the manager to start the actual capture. | 724 // Request the manager to start the actual capture. |
722 video_capture_manager_->Start(current_params_, this); | 725 video_capture_manager_->Start(current_params_, this); |
723 state_ = VIDEO_CAPTURE_STATE_STARTED; | 726 state_ = VIDEO_CAPTURE_STATE_STARTED; |
724 device_in_use_ = true; | 727 device_in_use_ = true; |
725 } | 728 } |
726 | 729 |
727 } // namespace content | 730 } // namespace content |
OLD | NEW |