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/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 const OutputDeviceAccessCB& callback, | 833 const OutputDeviceAccessCB& callback, |
834 bool have_access) { | 834 bool have_access) { |
835 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 835 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
836 callback.Run(have_access); | 836 callback.Run(have_access); |
837 } | 837 } |
838 | 838 |
839 void AudioRendererHost::TranslateDeviceID( | 839 void AudioRendererHost::TranslateDeviceID( |
840 const std::string& device_id, | 840 const std::string& device_id, |
841 const GURL& security_origin, | 841 const GURL& security_origin, |
842 const OutputDeviceInfoCB& callback, | 842 const OutputDeviceInfoCB& callback, |
843 const AudioOutputDeviceEnumeration& device_infos) { | 843 const AudioOutputDeviceEnumeration& enumeration) { |
844 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 844 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
845 for (const AudioOutputDeviceInfo& device_info : device_infos) { | 845 for (const AudioOutputDeviceInfo& device_info : enumeration.devices) { |
846 if (device_id.empty()) { | 846 if (device_id.empty()) { |
847 if (device_info.unique_id == media::AudioManagerBase::kDefaultDeviceId) { | 847 if (device_info.unique_id == media::AudioManagerBase::kDefaultDeviceId) { |
848 callback.Run(true, device_info); | 848 callback.Run(true, device_info); |
849 return; | 849 return; |
850 } | 850 } |
851 } else if (content::DoesMediaDeviceIDMatchHMAC(salt_callback_, | 851 } else if (content::DoesMediaDeviceIDMatchHMAC(salt_callback_, |
852 security_origin, device_id, | 852 security_origin, device_id, |
853 device_info.unique_id)) { | 853 device_info.unique_id)) { |
854 callback.Run(true, device_info); | 854 callback.Run(true, device_info); |
855 return; | 855 return; |
856 } | 856 } |
857 } | 857 } |
858 DCHECK(!device_id.empty()); // Default device must always be found | 858 DCHECK(!device_id.empty()); // Default device must always be found |
859 AudioOutputDeviceInfo device_info = {std::string(), std::string(), | 859 AudioOutputDeviceInfo device_info = {std::string(), std::string(), |
860 DummyParams()}; | 860 DummyParams()}; |
861 callback.Run(false, device_info); | 861 callback.Run(false, device_info); |
862 } | 862 } |
863 | 863 |
864 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 864 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
865 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 865 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
866 const auto& i = authorizations_.find(stream_id); | 866 const auto& i = authorizations_.find(stream_id); |
867 return i != authorizations_.end(); | 867 return i != authorizations_.end(); |
868 } | 868 } |
869 | 869 |
870 } // namespace content | 870 } // namespace content |
OLD | NEW |