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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 481 } |
482 | 482 |
483 // If enumerator caching is disabled, avoid the enumeration if the default | 483 // If enumerator caching is disabled, avoid the enumeration if the default |
484 // device is requested, since no device ID translation is needed. | 484 // device is requested, since no device ID translation is needed. |
485 // If enumerator caching is enabled, it is better to use its cache, even | 485 // If enumerator caching is enabled, it is better to use its cache, even |
486 // for the default device. | 486 // for the default device. |
487 if (IsDefaultDeviceId(device_id) && | 487 if (IsDefaultDeviceId(device_id) && |
488 !media_stream_manager_->audio_output_device_enumerator() | 488 !media_stream_manager_->audio_output_device_enumerator() |
489 ->IsCacheEnabled()) { | 489 ->IsCacheEnabled()) { |
490 base::PostTaskAndReplyWithResult( | 490 base::PostTaskAndReplyWithResult( |
491 audio_manager_->GetTaskRunner().get(), FROM_HERE, | 491 audio_manager_->GetTaskRunner(), FROM_HERE, |
492 base::Bind(&GetDefaultDeviceInfoOnDeviceThread, audio_manager_), | 492 base::Bind(&GetDefaultDeviceInfoOnDeviceThread, audio_manager_), |
493 base::Bind(&AudioRendererHost::OnDeviceIDTranslated, this, stream_id, | 493 base::Bind(&AudioRendererHost::OnDeviceIDTranslated, this, stream_id, |
494 true)); | 494 true)); |
495 } else { | 495 } else { |
496 media_stream_manager_->audio_output_device_enumerator()->Enumerate( | 496 media_stream_manager_->audio_output_device_enumerator()->Enumerate( |
497 base::Bind(&AudioRendererHost::TranslateDeviceID, this, device_id, | 497 base::Bind(&AudioRendererHost::TranslateDeviceID, this, device_id, |
498 gurl_security_origin, | 498 gurl_security_origin, |
499 base::Bind(&AudioRendererHost::OnDeviceIDTranslated, this, | 499 base::Bind(&AudioRendererHost::OnDeviceIDTranslated, this, |
500 stream_id))); | 500 stream_id))); |
501 } | 501 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 callback.Run(false, device_info); | 818 callback.Run(false, device_info); |
819 } | 819 } |
820 | 820 |
821 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 821 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
822 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 822 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
823 const auto& i = authorizations_.find(stream_id); | 823 const auto& i = authorizations_.find(stream_id); |
824 return i != authorizations_.end(); | 824 return i != authorizations_.end(); |
825 } | 825 } |
826 | 826 |
827 } // namespace content | 827 } // namespace content |
OLD | NEW |