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

Unified Diff: content/renderer/render_view_impl.cc

Issue 2763743002: Android: not to pause screen capture when Chrome is put to background (Closed)
Patch Set: address nits 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 0c57eceedfeb4a5ff928e02c11661de31f1f4558..14448249a1205cbd6e5a676cb94d1b1f0d7c5d53 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -84,6 +84,7 @@
#include "content/renderer/input/input_handler_manager.h"
#include "content/renderer/internal_document_state_data.h"
#include "content/renderer/media/audio_device_factory.h"
+#include "content/renderer/media/media_stream_dispatcher.h"
#include "content/renderer/media/video_capture_impl_manager.h"
#include "content/renderer/navigation_state_impl.h"
#include "content/renderer/render_frame_impl.h"
@@ -2277,12 +2278,13 @@ void RenderViewImpl::Close() {
}
void RenderViewImpl::OnPageWasHidden() {
-#if defined(OS_ANDROID) && BUILDFLAG(ENABLE_WEBRTC)
- RenderThreadImpl::current()->video_capture_impl_manager()->
- SuspendDevices(true);
+#if defined(OS_ANDROID)
+ SuspendVideoCaptureDevices(true);
+#if BUILDFLAG(ENABLE_WEBRTC)
if (speech_recognition_dispatcher_)
speech_recognition_dispatcher_->AbortAllRecognitions();
#endif
+#endif
if (webview()) {
// TODO(lfg): It's not correct to defer the page visibility to the main
@@ -2297,9 +2299,8 @@ void RenderViewImpl::OnPageWasHidden() {
}
void RenderViewImpl::OnPageWasShown() {
-#if defined(OS_ANDROID) && BUILDFLAG(ENABLE_WEBRTC)
- RenderThreadImpl::current()->video_capture_impl_manager()->
- SuspendDevices(false);
+#if defined(OS_ANDROID)
+ SuspendVideoCaptureDevices(false);
#endif
if (webview()) {
@@ -2568,6 +2569,21 @@ bool RenderViewImpl::didTapMultipleTargets(
return handled;
}
+
+void RenderViewImpl::SuspendVideoCaptureDevices(bool suspend) {
+ if (!main_render_frame_)
+ return;
+
+ MediaStreamDispatcher* media_stream_dispatcher =
+ main_render_frame_->GetMediaStreamDispatcher();
+ if (!media_stream_dispatcher)
+ return;
+
+ StreamDeviceInfoArray video_array =
+ media_stream_dispatcher->GetNonScreenCaptureDevices();
+ RenderThreadImpl::current()->video_capture_impl_manager()->SuspendDevices(
+ video_array, suspend);
+}
#endif // defined(OS_ANDROID)
unsigned RenderViewImpl::GetLocalSessionHistoryLengthForTesting() const {
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698