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

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 comments on PS#1 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
« content/renderer/render_view_impl.h ('K') | « 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..ddec70d698a98c3d9fe08667128f167941f719b2 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"
@@ -2278,8 +2279,8 @@ void RenderViewImpl::Close() {
void RenderViewImpl::OnPageWasHidden() {
#if defined(OS_ANDROID) && BUILDFLAG(ENABLE_WEBRTC)
miu 2017/03/22 23:09:43 Why does BUILDFLAG(ENABLE_WEBRTC) matter? This log
braveyao 2017/03/23 03:44:20 Done.
- RenderThreadImpl::current()->video_capture_impl_manager()->
- SuspendDevices(true);
+ SuspendVideoCaptureDevices(true);
+
if (speech_recognition_dispatcher_)
speech_recognition_dispatcher_->AbortAllRecognitions();
#endif
@@ -2298,8 +2299,7 @@ void RenderViewImpl::OnPageWasHidden() {
void RenderViewImpl::OnPageWasShown() {
#if defined(OS_ANDROID) && BUILDFLAG(ENABLE_WEBRTC)
miu 2017/03/22 23:09:43 Remove the BUILDFLAG(ENABLE_WEBRTC) part.
braveyao 2017/03/23 03:44:20 Done.
- RenderThreadImpl::current()->video_capture_impl_manager()->
- SuspendDevices(false);
+ SuspendVideoCaptureDevices(false);
#endif
if (webview()) {
@@ -2568,6 +2568,27 @@ 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) {
miu 2017/03/22 23:09:43 nit: if (!media_stream_dispatcher) return;
braveyao 2017/03/23 03:44:20 Done.
+ StreamDeviceInfoArray video_array;
+ media_stream_dispatcher->GetVideoCaptureDevices(&video_array);
+ for (const StreamDeviceInfo& device_info : video_array) {
+ if (suspend) {
miu 2017/03/22 23:09:43 See comments in header file about just having two
braveyao 2017/03/23 03:44:20 Done.
+ RenderThreadImpl::current()->video_capture_impl_manager()->Suspend(
+ device_info.session_id);
+ } else {
+ RenderThreadImpl::current()->video_capture_impl_manager()->Resume(
+ device_info.session_id);
+ }
+ }
+ }
+}
#endif // defined(OS_ANDROID)
unsigned RenderViewImpl::GetLocalSessionHistoryLengthForTesting() const {
« content/renderer/render_view_impl.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698