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

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

Issue 2291893002: Let Contraints Controll Mute/Unmute Audio Local Playback For Desktop Sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 2 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 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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 std::unique_ptr<media::VideoCaptureMachine>( 943 std::unique_ptr<media::VideoCaptureMachine>(
944 new WebContentsCaptureMachine(render_process_id, 944 new WebContentsCaptureMachine(render_process_id,
945 main_render_frame_id, 945 main_render_frame_id,
946 enable_auto_throttling)))) {} 946 enable_auto_throttling)))) {}
947 947
948 WebContentsVideoCaptureDevice::~WebContentsVideoCaptureDevice() { 948 WebContentsVideoCaptureDevice::~WebContentsVideoCaptureDevice() {
949 DVLOG(2) << "WebContentsVideoCaptureDevice@" << this << " destroying."; 949 DVLOG(2) << "WebContentsVideoCaptureDevice@" << this << " destroying.";
950 } 950 }
951 951
952 // static 952 // static
953 media::VideoCaptureDevice* WebContentsVideoCaptureDevice::Create( 953 std::unique_ptr<media::VideoCaptureDevice>
954 const std::string& device_id) { 954 WebContentsVideoCaptureDevice::Create(const std::string& device_id) {
955 // Parse device_id into render_process_id and main_render_frame_id. 955 // Parse device_id into render_process_id and main_render_frame_id.
956 int render_process_id = -1; 956 WebContentsMediaCaptureId media_id;
957 int main_render_frame_id = -1; 957 if (!WebContentsMediaCaptureId::Parse(device_id, &media_id)) {
958 if (!WebContentsMediaCaptureId::ExtractTabCaptureTarget(
959 device_id, &render_process_id, &main_render_frame_id)) {
960 return NULL; 958 return NULL;
961 } 959 }
962 960
963 return new WebContentsVideoCaptureDevice( 961 return std::unique_ptr<media::VideoCaptureDevice>(
Sergey Ulanov 2016/10/12 22:21:01 nit:: use base::MakeUnique<WebContentsVideoCapture
qiangchen 2016/10/12 22:49:54 Not work. As media::VideoCaptureDevice is an abstr
964 render_process_id, main_render_frame_id, 962 new WebContentsVideoCaptureDevice(media_id.render_process_id,
965 WebContentsMediaCaptureId::IsAutoThrottlingOptionSet(device_id)); 963 media_id.main_render_frame_id,
964 media_id.enable_auto_throttling));
966 } 965 }
967 966
968 void WebContentsVideoCaptureDevice::AllocateAndStart( 967 void WebContentsVideoCaptureDevice::AllocateAndStart(
969 const media::VideoCaptureParams& params, 968 const media::VideoCaptureParams& params,
970 std::unique_ptr<Client> client) { 969 std::unique_ptr<Client> client) {
971 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 970 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
972 core_->AllocateAndStart(params, std::move(client)); 971 core_->AllocateAndStart(params, std::move(client));
973 } 972 }
974 973
975 void WebContentsVideoCaptureDevice::RequestRefreshFrame() { 974 void WebContentsVideoCaptureDevice::RequestRefreshFrame() {
976 core_->RequestRefreshFrame(); 975 core_->RequestRefreshFrame();
977 } 976 }
978 977
979 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 978 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
980 core_->StopAndDeAllocate(); 979 core_->StopAndDeAllocate();
981 } 980 }
982 981
983 } // namespace content 982 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698