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

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

Issue 2673373003: getUserMeida: report device starting states (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_host.cc
diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc
index 4c458f5d0da72417407e3eefd565bb9d37e7cc44..56351604a7ff86b5cd70763cfecc76ad53ea3c4a 100644
--- a/content/browser/renderer_host/media/video_capture_host.cc
+++ b/content/browser/renderer_host/media/video_capture_host.cc
@@ -118,6 +118,21 @@ void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) {
controller_id));
}
+// OnStarted can be forwarded directly, while OnError&OnEnded need to be
+// scheduled to the end of message queue to guarantee some other clearing jobs
+// are done before they are handled.
+void VideoCaptureHost::OnStarted(VideoCaptureControllerID controller_id) {
chfremer 2017/02/16 01:00:50 Thanks. This piece of information is very useful t
braveyao 2017/02/17 20:37:21 Done.
+ DVLOG(1) << __func__;
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ if (controllers_.find(controller_id) == controllers_.end())
+ return;
+
+ if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
+ device_id_to_observer_map_[controller_id]->OnStateChanged(
+ mojom::VideoCaptureState::STARTED);
+ }
+}
+
void VideoCaptureHost::Start(int32_t device_id,
int32_t session_id,
const media::VideoCaptureParams& params,
@@ -306,11 +321,6 @@ void VideoCaptureHost::OnControllerAdded(
return;
}
- if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
- device_id_to_observer_map_[device_id]->OnStateChanged(
- mojom::VideoCaptureState::STARTED);
- }
-
DCHECK(!it->second);
it->second = controller;
}

Powered by Google App Engine
This is Rietveld 408576698