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

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

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: address comments on PS#3 Created 3 years, 10 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
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 ec20aa05f04d15f662c7042b303989a8dfc64d4c..5ace2a4f89386286ceffe6ef760fd7987ce9f612 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -149,6 +149,7 @@ VideoCaptureController::VideoCaptureController()
: consumer_feedback_observer_(nullptr),
state_(VIDEO_CAPTURE_STATE_STARTED),
has_received_frames_(false),
+ has_received_onstarted_(false),
weak_ptr_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
}
@@ -208,13 +209,16 @@ void VideoCaptureController::AddClient(
if (FindClient(id, event_handler, controller_clients_))
return;
+ // If the device has reported OnStarted event, report it to this client here.
+ if (has_received_onstarted_)
+ event_handler->OnStarted(id);
+
std::unique_ptr<ControllerClient> client =
base::MakeUnique<ControllerClient>(id, event_handler, session_id, params);
// If we already have gotten frame_info from the device, repeat it to the new
// client.
if (state_ == VIDEO_CAPTURE_STATE_STARTED) {
controller_clients_.push_back(std::move(client));
- return;
}
}
@@ -463,6 +467,7 @@ void VideoCaptureController::OnLog(const std::string& message) {
void VideoCaptureController::OnStarted() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ has_received_onstarted_ = true;
for (const auto& client : controller_clients_) {
if (client->session_closed)

Powered by Google App Engine
This is Rietveld 408576698