OLD | NEW |
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 #include "content/browser/renderer_host/media/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const media::VideoCaptureFormats& supported_formats) | 89 const media::VideoCaptureFormats& supported_formats) |
90 : name(name), | 90 : name(name), |
91 supported_formats(supported_formats) {} | 91 supported_formats(supported_formats) {} |
92 | 92 |
93 VideoCaptureManager::DeviceInfo::~DeviceInfo() {} | 93 VideoCaptureManager::DeviceInfo::~DeviceInfo() {} |
94 | 94 |
95 VideoCaptureManager::VideoCaptureManager( | 95 VideoCaptureManager::VideoCaptureManager( |
96 scoped_ptr<media::VideoCaptureDeviceFactory> factory) | 96 scoped_ptr<media::VideoCaptureDeviceFactory> factory) |
97 : listener_(NULL), | 97 : listener_(NULL), |
98 new_capture_session_id_(1), | 98 new_capture_session_id_(1), |
99 video_capture_device_factory_(factory.Pass()) { | 99 video_capture_device_factory_(factory.Pass()), |
| 100 display_rotation_(gfx::Display::ROTATE_0) { |
100 } | 101 } |
101 | 102 |
102 VideoCaptureManager::~VideoCaptureManager() { | 103 VideoCaptureManager::~VideoCaptureManager() { |
103 DCHECK(devices_.empty()); | 104 DCHECK(devices_.empty()); |
104 } | 105 } |
105 | 106 |
| 107 void VideoCaptureManager::SetDisplayRotation(gfx::Display::Rotation rotation) { |
| 108 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 109 display_rotation_ = rotation; |
| 110 for (DeviceEntries::iterator it = devices_.begin(); |
| 111 it != devices_.end(); ++it) { |
| 112 DeviceEntry* device = *it; |
| 113 if (device->stream_type == MEDIA_DEVICE_VIDEO_CAPTURE) |
| 114 device->video_capture_controller->set_display_rotation(display_rotation_); |
| 115 } |
| 116 } |
| 117 |
106 void VideoCaptureManager::Register( | 118 void VideoCaptureManager::Register( |
107 MediaStreamProviderListener* listener, | 119 MediaStreamProviderListener* listener, |
108 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) { | 120 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) { |
109 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 121 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
110 DCHECK(!listener_); | 122 DCHECK(!listener_); |
111 DCHECK(!device_task_runner_.get()); | 123 DCHECK(!device_task_runner_.get()); |
112 listener_ = listener; | 124 listener_ = listener; |
113 device_task_runner_ = device_task_runner; | 125 device_task_runner_ = device_task_runner; |
114 } | 126 } |
115 | 127 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // use that opened device. | 584 // use that opened device. |
573 DeviceEntry* const existing_device = | 585 DeviceEntry* const existing_device = |
574 GetDeviceEntryForMediaStreamDevice(device_info); | 586 GetDeviceEntryForMediaStreamDevice(device_info); |
575 if (existing_device) { | 587 if (existing_device) { |
576 DCHECK_EQ(device_info.type, existing_device->stream_type); | 588 DCHECK_EQ(device_info.type, existing_device->stream_type); |
577 return existing_device; | 589 return existing_device; |
578 } | 590 } |
579 | 591 |
580 scoped_ptr<VideoCaptureController> video_capture_controller( | 592 scoped_ptr<VideoCaptureController> video_capture_controller( |
581 new VideoCaptureController()); | 593 new VideoCaptureController()); |
| 594 |
| 595 if (device_info.type == MEDIA_DEVICE_VIDEO_CAPTURE) |
| 596 video_capture_controller->set_display_rotation(display_rotation_); |
582 DeviceEntry* new_device = new DeviceEntry(device_info.type, | 597 DeviceEntry* new_device = new DeviceEntry(device_info.type, |
583 device_info.id, | 598 device_info.id, |
584 video_capture_controller.Pass()); | 599 video_capture_controller.Pass()); |
585 devices_.insert(new_device); | 600 devices_.insert(new_device); |
586 return new_device; | 601 return new_device; |
587 } | 602 } |
588 | 603 |
589 VideoCaptureManager::DeviceInfo* VideoCaptureManager::FindDeviceInfoById( | 604 VideoCaptureManager::DeviceInfo* VideoCaptureManager::FindDeviceInfoById( |
590 const std::string& id, | 605 const std::string& id, |
591 DeviceInfos& device_vector) { | 606 DeviceInfos& device_vector) { |
(...skipping 20 matching lines...) Expand all Loading... |
612 void VideoCaptureManager::SaveDesktopCaptureWindowIdOnDeviceThread( | 627 void VideoCaptureManager::SaveDesktopCaptureWindowIdOnDeviceThread( |
613 media::VideoCaptureSessionId session_id, | 628 media::VideoCaptureSessionId session_id, |
614 gfx::NativeViewId window_id) { | 629 gfx::NativeViewId window_id) { |
615 DCHECK(IsOnDeviceThread()); | 630 DCHECK(IsOnDeviceThread()); |
616 DCHECK(notification_window_ids_.find(session_id) == | 631 DCHECK(notification_window_ids_.find(session_id) == |
617 notification_window_ids_.end()); | 632 notification_window_ids_.end()); |
618 notification_window_ids_[session_id] = window_id; | 633 notification_window_ids_[session_id] = window_id; |
619 } | 634 } |
620 | 635 |
621 } // namespace content | 636 } // namespace content |
OLD | NEW |