Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
| 41 #include "content/public/browser/desktop_media_id.h" | 41 #include "content/public/browser/desktop_media_id.h" |
| 42 #include "content/public/browser/media_observer.h" | 42 #include "content/public/browser/media_observer.h" |
| 43 #include "content/public/browser/media_request_state.h" | 43 #include "content/public/browser/media_request_state.h" |
| 44 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
| 45 #include "content/public/browser/web_contents_media_capture_id.h" | 45 #include "content/public/browser/web_contents_media_capture_id.h" |
| 46 #include "content/public/common/content_client.h" | 46 #include "content/public/common/content_client.h" |
| 47 #include "content/public/common/content_switches.h" | 47 #include "content/public/common/content_switches.h" |
| 48 #include "content/public/common/media_stream_request.h" | 48 #include "content/public/common/media_stream_request.h" |
| 49 #include "crypto/hmac.h" | 49 #include "crypto/hmac.h" |
| 50 #include "media/audio/audio_logging.h" | |
| 50 #include "media/audio/audio_manager_base.h" | 51 #include "media/audio/audio_manager_base.h" |
| 51 #include "media/audio/audio_parameters.h" | 52 #include "media/audio/audio_parameters.h" |
| 52 #include "media/base/channel_layout.h" | 53 #include "media/base/channel_layout.h" |
| 53 #include "media/base/media_switches.h" | 54 #include "media/base/media_switches.h" |
| 54 #include "media/capture/video/video_capture_device_factory.h" | 55 #include "media/capture/video/video_capture_device_factory.h" |
| 55 #include "url/gurl.h" | 56 #include "url/gurl.h" |
| 56 | 57 |
| 57 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 58 #include "base/win/scoped_com_initializer.h" | 59 #include "base/win/scoped_com_initializer.h" |
| 59 #endif | 60 #endif |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 BrowserThread::IO, FROM_HERE, | 406 BrowserThread::IO, FROM_HERE, |
| 406 base::Bind(&MediaStreamManager::InitializeDeviceManagersOnIOThread, | 407 base::Bind(&MediaStreamManager::InitializeDeviceManagersOnIOThread, |
| 407 base::Unretained(this))); | 408 base::Unretained(this))); |
| 408 } | 409 } |
| 409 | 410 |
| 410 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | 411 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); |
| 411 // BrowserMainLoop always creates the PowerMonitor instance before creating | 412 // BrowserMainLoop always creates the PowerMonitor instance before creating |
| 412 // MediaStreamManager, but power_monitor may be NULL in unit tests. | 413 // MediaStreamManager, but power_monitor may be NULL in unit tests. |
| 413 if (power_monitor) | 414 if (power_monitor) |
| 414 power_monitor->AddObserver(this); | 415 power_monitor->AddObserver(this); |
| 416 | |
| 417 media::InitWebRtcLoggingCallback(&MediaStreamManager::SendMessageToNativeLog); | |
|
o1ka
2016/04/05 15:28:42
I would do it the first thing in the constructor.
| |
| 415 } | 418 } |
| 416 | 419 |
| 417 MediaStreamManager::~MediaStreamManager() { | 420 MediaStreamManager::~MediaStreamManager() { |
| 418 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::IO)); | 421 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::IO)); |
| 419 DVLOG(1) << "~MediaStreamManager"; | 422 DVLOG(1) << "~MediaStreamManager"; |
| 420 DCHECK(requests_.empty()); | 423 DCHECK(requests_.empty()); |
| 421 DCHECK(!device_task_runner_.get()); | 424 DCHECK(!device_task_runner_.get()); |
| 422 | 425 |
| 423 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | 426 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); |
| 424 // The PowerMonitor instance owned by BrowserMainLoops always outlives the | 427 // The PowerMonitor instance owned by BrowserMainLoops always outlives the |
| (...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2117 const std::string& device_guid, | 2120 const std::string& device_guid, |
| 2118 const std::string& raw_unique_id) { | 2121 const std::string& raw_unique_id) { |
| 2119 DCHECK(security_origin.is_valid()); | 2122 DCHECK(security_origin.is_valid()); |
| 2120 DCHECK(!raw_unique_id.empty()); | 2123 DCHECK(!raw_unique_id.empty()); |
| 2121 std::string guid_from_raw_device_id = | 2124 std::string guid_from_raw_device_id = |
| 2122 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); | 2125 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); |
| 2123 return guid_from_raw_device_id == device_guid; | 2126 return guid_from_raw_device_id == device_guid; |
| 2124 } | 2127 } |
| 2125 | 2128 |
| 2126 } // namespace content | 2129 } // namespace content |
| OLD | NEW |