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