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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 648
649 // This function is called when all buffers have been returned to controller, 649 // This function is called when all buffers have been returned to controller,
650 // or when device is stopped. It decides whether the device needs to be 650 // or when device is stopped. It decides whether the device needs to be
651 // restarted. 651 // restarted.
652 void VideoCaptureController::PostStopping() { 652 void VideoCaptureController::PostStopping() {
653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
654 DCHECK_EQ(state_, VIDEO_CAPTURE_STATE_STOPPING); 654 DCHECK_EQ(state_, VIDEO_CAPTURE_STATE_STOPPING);
655 655
656 // When clients still have some buffers, or device has not been stopped yet, 656 // When clients still have some buffers, or device has not been stopped yet,
657 // do nothing. 657 // do nothing.
658 if (buffer_pool_->IsAnyBufferHeldForConsumers() || device_in_use_) 658 if ((buffer_pool_ && buffer_pool_->IsAnyBufferHeldForConsumers()) ||
wjia(left Chromium) 2013/05/16 00:14:16 Should this check be also added for other cases (w
ncarter (slow) 2013/05/16 00:32:31 It wouldn't hurt, but it's certainly not necessary
659 device_in_use_)
659 return; 660 return;
660 661
661 { 662 {
662 base::AutoLock lock(buffer_pool_lock_); 663 base::AutoLock lock(buffer_pool_lock_);
663 buffer_pool_ = NULL; 664 buffer_pool_ = NULL;
664 } 665 }
665 666
666 // No more client. Therefore the controller is stopped. 667 // No more client. Therefore the controller is stopped.
667 if (controller_clients_.empty() && pending_clients_.empty()) { 668 if (controller_clients_.empty() && pending_clients_.empty()) {
668 state_ = VIDEO_CAPTURE_STATE_STOPPED; 669 state_ = VIDEO_CAPTURE_STATE_STOPPED;
(...skipping 20 matching lines...) Expand all
689 controller_clients_.push_back((*client_it)); 690 controller_clients_.push_back((*client_it));
690 pending_clients_.erase(client_it++); 691 pending_clients_.erase(client_it++);
691 } 692 }
692 // Request the manager to start the actual capture. 693 // Request the manager to start the actual capture.
693 video_capture_manager_->Start(current_params_, this); 694 video_capture_manager_->Start(current_params_, this);
694 state_ = VIDEO_CAPTURE_STATE_STARTED; 695 state_ = VIDEO_CAPTURE_STATE_STARTED;
695 device_in_use_ = true; 696 device_in_use_ = true;
696 } 697 }
697 698
698 } // namespace content 699 } // namespace content
OLDNEW
« 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