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

Unified Diff: content/renderer/media/video_capture_impl_manager.cc

Issue 2763743002: Android: not to pause screen capture when Chrome is put to background (Closed)
Patch Set: restore logic in VideoCaptureImplManager Created 3 years, 9 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/renderer/media/video_capture_impl_manager.cc
diff --git a/content/renderer/media/video_capture_impl_manager.cc b/content/renderer/media/video_capture_impl_manager.cc
index 678dfef28cfeb12101ce5e0ece224bb17656fabf..6f81b8738f6bfcbc5b089325b61fb5fbaa8e143c 100644
--- a/content/renderer/media/video_capture_impl_manager.cc
+++ b/content/renderer/media/video_capture_impl_manager.cc
@@ -234,17 +234,24 @@ void VideoCaptureImplManager::UnrefDevice(
devices_.erase(it);
}
-void VideoCaptureImplManager::SuspendDevices(bool suspend) {
+void VideoCaptureImplManager::SuspendDevices(
+ const StreamDeviceInfoArray& video_device_array,
+ bool suspend) {
DCHECK(render_main_task_runner_->BelongsToCurrentThread());
if (is_suspending_all_ == suspend)
return;
is_suspending_all_ = suspend;
- for (auto& entry : devices_) {
- if (entry.is_individually_suspended)
+ for (const StreamDeviceInfo& device_info : video_device_array) {
+ const media::VideoCaptureSessionId id = device_info.session_id;
+ const auto it = std::find_if(
+ devices_.begin(), devices_.end(),
+ [id](const DeviceEntry& entry) { return entry.session_id == id; });
+ DCHECK(it != devices_.end());
+ if (it->is_individually_suspended)
continue; // Either: 1) Already suspended; or 2) Should not be resumed.
ChildProcess::current()->io_task_runner()->PostTask(
FROM_HERE, base::Bind(&VideoCaptureImpl::SuspendCapture,
- base::Unretained(entry.impl.get()), suspend));
+ base::Unretained(it->impl.get()), suspend));
}
}

Powered by Google App Engine
This is Rietveld 408576698