Commit 2c2ad6e2 authored by nick@chromium.org's avatar nick@chromium.org

Check buffer_pool_ for null in VideoCaptureController::PostStopping.

buffer_pool_lock_ is not needed on the UI thread for this test, but if the
camera started and stopped without an OnFrameInfo, then it's possible that
the buffer_pool_ was never created.

BUG=231723

Review URL: https://chromiumcodereview.appspot.com/15070008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203069 0039d316-1c4b-4281-b951-d872f2087c98
parent 71e22d62
...@@ -178,10 +178,12 @@ void VideoCaptureController::StopCapture( ...@@ -178,10 +178,12 @@ void VideoCaptureController::StopCapture(
return; return;
// Take back all buffers held by the |client|. // Take back all buffers held by the |client|.
for (std::set<int>::iterator buffer_it = client->buffers.begin(); if (buffer_pool_) {
buffer_it != client->buffers.end(); ++buffer_it) { for (std::set<int>::iterator buffer_it = client->buffers.begin();
int buffer_id = *buffer_it; buffer_it != client->buffers.end(); ++buffer_it) {
buffer_pool_->RelinquishConsumerHold(buffer_id, 1); int buffer_id = *buffer_it;
buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
}
} }
client->buffers.clear(); client->buffers.clear();
...@@ -607,6 +609,9 @@ void VideoCaptureController::SendFrameInfoAndBuffers(ControllerClient* client) { ...@@ -607,6 +609,9 @@ void VideoCaptureController::SendFrameInfoAndBuffers(ControllerClient* client) {
client->event_handler->OnFrameInfo(client->controller_id, client->event_handler->OnFrameInfo(client->controller_id,
frame_info_.width, frame_info_.height, frame_info_.width, frame_info_.height,
frame_info_.frame_rate); frame_info_.frame_rate);
if (!buffer_pool_)
return;
for (int buffer_id = 1; buffer_id <= buffer_pool_->count(); ++buffer_id) { for (int buffer_id = 1; buffer_id <= buffer_pool_->count(); ++buffer_id) {
base::SharedMemoryHandle remote_handle = base::SharedMemoryHandle remote_handle =
buffer_pool_->ShareToProcess(buffer_id, client->render_process_handle); buffer_pool_->ShareToProcess(buffer_id, client->render_process_handle);
...@@ -655,7 +660,8 @@ void VideoCaptureController::PostStopping() { ...@@ -655,7 +660,8 @@ void VideoCaptureController::PostStopping() {
// When clients still have some buffers, or device has not been stopped yet, // When clients still have some buffers, or device has not been stopped yet,
// do nothing. // do nothing.
if (buffer_pool_->IsAnyBufferHeldForConsumers() || device_in_use_) if ((buffer_pool_ && buffer_pool_->IsAnyBufferHeldForConsumers()) ||
device_in_use_)
return; return;
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment