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

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device.cc

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review round 4 Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Spanning several threads, the process of capturing has been 7 // performance. Spanning several threads, the process of capturing has been
8 // split up into four conceptual stages: 8 // split up into four conceptual stages:
9 // 9 //
10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "base/logging.h" 59 #include "base/logging.h"
60 #include "base/memory/scoped_ptr.h" 60 #include "base/memory/scoped_ptr.h"
61 #include "base/memory/weak_ptr.h" 61 #include "base/memory/weak_ptr.h"
62 #include "base/metrics/histogram.h" 62 #include "base/metrics/histogram.h"
63 #include "base/sequenced_task_runner.h" 63 #include "base/sequenced_task_runner.h"
64 #include "base/single_thread_task_runner.h" 64 #include "base/single_thread_task_runner.h"
65 #include "base/threading/thread.h" 65 #include "base/threading/thread.h"
66 #include "base/threading/thread_checker.h" 66 #include "base/threading/thread_checker.h"
67 #include "base/time/time.h" 67 #include "base/time/time.h"
68 #include "content/browser/media/capture/cursor_renderer.h" 68 #include "content/browser/media/capture/cursor_renderer.h"
69 #include "content/browser/media/capture/web_contents_capture_util.h"
70 #include "content/browser/media/capture/web_contents_tracker.h" 69 #include "content/browser/media/capture/web_contents_tracker.h"
71 #include "content/browser/renderer_host/render_widget_host_impl.h" 70 #include "content/browser/renderer_host/render_widget_host_impl.h"
72 #include "content/browser/renderer_host/render_widget_host_view_base.h" 71 #include "content/browser/renderer_host/render_widget_host_view_base.h"
73 #include "content/public/browser/browser_thread.h" 72 #include "content/public/browser/browser_thread.h"
74 #include "content/public/browser/render_process_host.h" 73 #include "content/public/browser/render_process_host.h"
75 #include "content/public/browser/render_widget_host_view.h" 74 #include "content/public/browser/render_widget_host_view.h"
76 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 75 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
77 #include "content/public/browser/web_contents.h" 76 #include "content/public/browser/web_contents.h"
77 #include "content/public/browser/web_contents_media_capture_id.h"
78 #include "media/base/bind_to_current_loop.h" 78 #include "media/base/bind_to_current_loop.h"
79 #include "media/base/video_capture_types.h" 79 #include "media/base/video_capture_types.h"
80 #include "media/base/video_util.h" 80 #include "media/base/video_util.h"
81 #include "media/capture/content/screen_capture_device_core.h" 81 #include "media/capture/content/screen_capture_device_core.h"
82 #include "media/capture/content/thread_safe_capture_oracle.h" 82 #include "media/capture/content/thread_safe_capture_oracle.h"
83 #include "media/capture/content/video_capture_oracle.h" 83 #include "media/capture/content/video_capture_oracle.h"
84 #include "skia/ext/image_operations.h" 84 #include "skia/ext/image_operations.h"
85 #include "third_party/skia/include/core/SkBitmap.h" 85 #include "third_party/skia/include/core/SkBitmap.h"
86 #include "third_party/skia/include/core/SkColor.h" 86 #include "third_party/skia/include/core/SkColor.h"
87 #include "ui/base/layout.h" 87 #include "ui/base/layout.h"
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 WebContentsVideoCaptureDevice::~WebContentsVideoCaptureDevice() { 886 WebContentsVideoCaptureDevice::~WebContentsVideoCaptureDevice() {
887 DVLOG(2) << "WebContentsVideoCaptureDevice@" << this << " destroying."; 887 DVLOG(2) << "WebContentsVideoCaptureDevice@" << this << " destroying.";
888 } 888 }
889 889
890 // static 890 // static
891 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create( 891 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create(
892 const std::string& device_id) { 892 const std::string& device_id) {
893 // Parse device_id into render_process_id and main_render_frame_id. 893 // Parse device_id into render_process_id and main_render_frame_id.
894 int render_process_id = -1; 894 int render_process_id = -1;
895 int main_render_frame_id = -1; 895 int main_render_frame_id = -1;
896 if (!WebContentsCaptureUtil::ExtractTabCaptureTarget( 896 if (!WebContentsMediaCaptureId::ExtractTabCaptureTarget(
897 device_id, &render_process_id, &main_render_frame_id)) { 897 device_id, &render_process_id, &main_render_frame_id)) {
898 return NULL; 898 return NULL;
899 } 899 }
900 900
901 return new WebContentsVideoCaptureDevice( 901 return new WebContentsVideoCaptureDevice(
902 render_process_id, 902 render_process_id, main_render_frame_id,
903 main_render_frame_id, 903 WebContentsMediaCaptureId::IsAutoThrottlingOptionSet(device_id));
904 WebContentsCaptureUtil::IsAutoThrottlingOptionSet(device_id));
905 } 904 }
906 905
907 void WebContentsVideoCaptureDevice::AllocateAndStart( 906 void WebContentsVideoCaptureDevice::AllocateAndStart(
908 const media::VideoCaptureParams& params, 907 const media::VideoCaptureParams& params,
909 scoped_ptr<Client> client) { 908 scoped_ptr<Client> client) {
910 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 909 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
911 core_->AllocateAndStart(params, client.Pass()); 910 core_->AllocateAndStart(params, client.Pass());
912 } 911 }
913 912
914 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 913 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
915 core_->StopAndDeAllocate(); 914 core_->StopAndDeAllocate();
916 } 915 }
917 916
918 } // namespace content 917 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698