Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 15070008: Check buffer_pool_ for null in VideoCaptureController::PostStopping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added null checks everywhere. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_controller.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index b82b7969ca7b13a82c258f36b5cdabcbdd30fc39..a0a0cd1eda2b98d14cb9bd1cfe422358e33769e0 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -178,10 +178,12 @@ void VideoCaptureController::StopCapture(
return;
// Take back all buffers held by the |client|.
- for (std::set<int>::iterator buffer_it = client->buffers.begin();
- buffer_it != client->buffers.end(); ++buffer_it) {
- int buffer_id = *buffer_it;
- buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
+ if (buffer_pool_) {
+ for (std::set<int>::iterator buffer_it = client->buffers.begin();
+ buffer_it != client->buffers.end(); ++buffer_it) {
+ int buffer_id = *buffer_it;
+ buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
+ }
}
client->buffers.clear();
@@ -607,6 +609,9 @@ void VideoCaptureController::SendFrameInfoAndBuffers(ControllerClient* client) {
client->event_handler->OnFrameInfo(client->controller_id,
frame_info_.width, frame_info_.height,
frame_info_.frame_rate);
+ if (!buffer_pool_)
+ return;
+
for (int buffer_id = 1; buffer_id <= buffer_pool_->count(); ++buffer_id) {
base::SharedMemoryHandle remote_handle =
buffer_pool_->ShareToProcess(buffer_id, client->render_process_handle);
@@ -655,7 +660,8 @@ void VideoCaptureController::PostStopping() {
// When clients still have some buffers, or device has not been stopped yet,
// do nothing.
- if (buffer_pool_->IsAnyBufferHeldForConsumers() || device_in_use_)
+ if ((buffer_pool_ && buffer_pool_->IsAnyBufferHeldForConsumers()) ||
+ device_in_use_)
return;
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698