OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
9 #include "content/browser/media/capture/aura_window_capture_machine.h" | 9 #include "content/browser/media/capture/aura_window_capture_machine.h" |
10 #include "content/browser/media/capture/content_video_capture_device_core.h" | |
11 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
12 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 | 14 |
16 namespace { | 15 namespace { |
17 | 16 |
18 void SetCaptureSource(AuraWindowCaptureMachine* machine, | 17 void SetCaptureSource(AuraWindowCaptureMachine* machine, |
19 const DesktopMediaID& source) { | 18 const DesktopMediaID& source) { |
20 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 19 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
21 | 20 |
22 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); | 21 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); |
23 machine->SetWindow(window); | 22 machine->SetWindow(window); |
24 } | 23 } |
25 | 24 |
26 } // namespace | 25 } // namespace |
27 | 26 |
28 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( | 27 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( |
29 const DesktopMediaID& source) { | 28 const DesktopMediaID& source) { |
30 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); | 29 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); |
31 core_.reset(new ContentVideoCaptureDeviceCore(make_scoped_ptr(machine))); | 30 core_.reset(new media::ScreenCaptureDeviceCore(make_scoped_ptr(machine))); |
32 // |core_| owns |machine| and deletes it on UI thread so passing the raw | 31 // |core_| owns |machine| and deletes it on UI thread so passing the raw |
33 // pointer to the UI thread is safe here. | 32 // pointer to the UI thread is safe here. |
34 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 33 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
35 base::Bind(&SetCaptureSource, machine, source)); | 34 base::Bind(&SetCaptureSource, machine, source)); |
36 } | 35 } |
37 | 36 |
38 DesktopCaptureDeviceAura::~DesktopCaptureDeviceAura() { | 37 DesktopCaptureDeviceAura::~DesktopCaptureDeviceAura() { |
39 DVLOG(2) << "DesktopCaptureDeviceAura@" << this << " destroying."; | 38 DVLOG(2) << "DesktopCaptureDeviceAura@" << this << " destroying."; |
40 } | 39 } |
41 | 40 |
42 // static | 41 // static |
43 media::VideoCaptureDevice* DesktopCaptureDeviceAura::Create( | 42 media::VideoCaptureDevice* DesktopCaptureDeviceAura::Create( |
44 const DesktopMediaID& source) { | 43 const DesktopMediaID& source) { |
45 return new DesktopCaptureDeviceAura(source); | 44 return new DesktopCaptureDeviceAura(source); |
46 } | 45 } |
47 | 46 |
48 void DesktopCaptureDeviceAura::AllocateAndStart( | 47 void DesktopCaptureDeviceAura::AllocateAndStart( |
49 const media::VideoCaptureParams& params, | 48 const media::VideoCaptureParams& params, |
50 scoped_ptr<Client> client) { | 49 scoped_ptr<Client> client) { |
51 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 50 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
52 core_->AllocateAndStart(params, client.Pass()); | 51 core_->AllocateAndStart(params, client.Pass()); |
53 } | 52 } |
54 | 53 |
55 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 54 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
56 core_->StopAndDeAllocate(); | 55 core_->StopAndDeAllocate(); |
57 } | 56 } |
58 | 57 |
59 } // namespace content | 58 } // namespace content |
OLD | NEW |