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/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 #include "base/win/scoped_com_initializer.h" | 42 #include "base/win/scoped_com_initializer.h" |
43 #endif | 43 #endif |
44 | 44 |
45 namespace content { | 45 namespace content { |
46 | 46 |
47 // Forward declaration of DeviceMonitorMac and its only useable method. | 47 // Forward declaration of DeviceMonitorMac and its only useable method. |
48 class DeviceMonitorMac { | 48 class DeviceMonitorMac { |
49 public: | 49 public: |
50 void StartMonitoring( | 50 void StartMonitoring( |
51 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); | 51 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); |
52 }; | 52 }; |
53 | 53 |
54 namespace { | 54 namespace { |
55 // Creates a random label used to identify requests. | 55 // Creates a random label used to identify requests. |
56 std::string RandomLabel() { | 56 std::string RandomLabel() { |
57 // An earlier PeerConnection spec, | 57 // An earlier PeerConnection spec, |
58 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the | 58 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the |
59 // MediaStream::label alphabet as containing 36 characters from | 59 // MediaStream::label alphabet as containing 36 characters from |
60 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, | 60 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, |
61 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. | 61 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1600 PostRequestToUI(*it, request); | 1600 PostRequestToUI(*it, request); |
1601 } | 1601 } |
1602 break; | 1602 break; |
1603 } | 1603 } |
1604 } | 1604 } |
1605 label_list.clear(); | 1605 label_list.clear(); |
1606 --active_enumeration_ref_count_[stream_type]; | 1606 --active_enumeration_ref_count_[stream_type]; |
1607 DCHECK_GE(active_enumeration_ref_count_[stream_type], 0); | 1607 DCHECK_GE(active_enumeration_ref_count_[stream_type], 0); |
1608 } | 1608 } |
1609 | 1609 |
1610 void MediaStreamManager::Aborted(MediaStreamType stream_type, | |
1611 int capture_session_id) { | |
1612 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
1613 DVLOG(1) << "Aborted({stream_type = " << stream_type << "} " | |
1614 << "{capture_session_id = " << capture_session_id << "})"; | |
1615 | |
1616 for (DeviceRequests::iterator request_it = requests_.begin(); | |
1617 request_it != requests_.end(); ++request_it) { | |
1618 DeviceRequest* request = request_it->second; | |
1619 StreamDeviceInfoArray* devices = &(request->devices); | |
1620 | |
1621 for (StreamDeviceInfoArray::iterator device_it = devices->begin(); | |
1622 device_it != devices->end(); ++device_it) { | |
1623 if (device_it->device.type == stream_type && | |
1624 device_it->session_id == capture_session_id) { | |
1625 StopDevice(stream_type, capture_session_id); | |
1626 return; | |
1627 } | |
1628 } | |
1629 } | |
mcasas
2014/04/24 11:09:47
Is not common in this file, but should we add NOTR
jiayl
2014/04/24 18:11:13
Done.
| |
1630 } | |
1631 | |
1610 // static | 1632 // static |
1611 void MediaStreamManager::SendMessageToNativeLog(const std::string& message) { | 1633 void MediaStreamManager::SendMessageToNativeLog(const std::string& message) { |
1612 BrowserThread::PostTask( | 1634 BrowserThread::PostTask( |
1613 BrowserThread::UI, FROM_HERE, | 1635 BrowserThread::UI, FROM_HERE, |
1614 base::Bind(DoAddLogMessage, message)); | 1636 base::Bind(DoAddLogMessage, message)); |
1615 } | 1637 } |
1616 | 1638 |
1617 void MediaStreamManager::OnSuspend() { | 1639 void MediaStreamManager::OnSuspend() { |
1618 SendMessageToNativeLog("Power state suspended."); | 1640 SendMessageToNativeLog("Power state suspended."); |
1619 } | 1641 } |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1923 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { | 1945 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { |
1924 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, | 1946 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, |
1925 window_id); | 1947 window_id); |
1926 break; | 1948 break; |
1927 } | 1949 } |
1928 } | 1950 } |
1929 } | 1951 } |
1930 } | 1952 } |
1931 | 1953 |
1932 } // namespace content | 1954 } // namespace content |
OLD | NEW |