| 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 "media/audio/audio_output_device.h" | 5 #include "media/audio/audio_output_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 DCHECK_EQ(state_, AUTHORIZING); | 318 DCHECK_EQ(state_, AUTHORIZING); |
| 319 | 319 |
| 320 // It may happen that a second authorization is received as a result to a | 320 // It may happen that a second authorization is received as a result to a |
| 321 // call to Start() after Stop(). If the status for the second authorization | 321 // call to Start() after Stop(). If the status for the second authorization |
| 322 // differs from the first, it will not be reflected in |device_status_| | 322 // differs from the first, it will not be reflected in |device_status_| |
| 323 // to avoid a race. | 323 // to avoid a race. |
| 324 // This scenario is unlikely. If it occurs, the new value will be | 324 // This scenario is unlikely. If it occurs, the new value will be |
| 325 // different from OUTPUT_DEVICE_STATUS_OK, so the AudioOutputDevice | 325 // different from OUTPUT_DEVICE_STATUS_OK, so the AudioOutputDevice |
| 326 // will enter the IPC_CLOSED state anyway, which is the safe thing to do. | 326 // will enter the IPC_CLOSED state anyway, which is the safe thing to do. |
| 327 // This is preferable to holding a lock. | 327 // This is preferable to holding a lock. |
| 328 if (!did_receive_auth_.IsSignaled()) | 328 if (!did_receive_auth_.IsSignaled()) { |
| 329 device_status_ = device_status; | 329 device_status_ = device_status; |
| 330 UMA_HISTOGRAM_ENUMERATION("Media.Audio.Render.OutputDeviceStatus", |
| 331 device_status, OUTPUT_DEVICE_STATUS_MAX + 1); |
| 332 } |
| 330 | 333 |
| 331 if (device_status == OUTPUT_DEVICE_STATUS_OK) { | 334 if (device_status == OUTPUT_DEVICE_STATUS_OK) { |
| 332 state_ = AUTHORIZED; | 335 state_ = AUTHORIZED; |
| 333 if (!did_receive_auth_.IsSignaled()) { | 336 if (!did_receive_auth_.IsSignaled()) { |
| 334 output_params_ = output_params; | 337 output_params_ = output_params; |
| 335 | 338 |
| 336 // It's possible to not have a matched device obtained via session id. It | 339 // It's possible to not have a matched device obtained via session id. It |
| 337 // means matching output device through |session_id_| failed and the | 340 // means matching output device through |session_id_| failed and the |
| 338 // default device is used. | 341 // default device is used. |
| 339 DCHECK(AudioDeviceDescription::UseSessionIdToSelectDevice(session_id_, | 342 DCHECK(AudioDeviceDescription::UseSessionIdToSelectDevice(session_id_, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 render_callback_->Render(delay, delay_timestamp, frames_skipped, | 487 render_callback_->Render(delay, delay_timestamp, frames_skipped, |
| 485 output_bus_.get()); | 488 output_bus_.get()); |
| 486 } | 489 } |
| 487 | 490 |
| 488 bool AudioOutputDevice::AudioThreadCallback:: | 491 bool AudioOutputDevice::AudioThreadCallback:: |
| 489 CurrentThreadIsAudioDeviceThread() { | 492 CurrentThreadIsAudioDeviceThread() { |
| 490 return thread_checker_.CalledOnValidThread(); | 493 return thread_checker_.CalledOnValidThread(); |
| 491 } | 494 } |
| 492 | 495 |
| 493 } // namespace media | 496 } // namespace media |
| OLD | NEW |