| 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 // THREAD SAFETY | 5 // THREAD SAFETY |
| 6 // | 6 // |
| 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used | 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used |
| 8 // from the audio thread. We DCHECK on this assumption whenever we can. | 8 // from the audio thread. We DCHECK on this assumption whenever we can. |
| 9 // | 9 // |
| 10 // SEMANTICS OF Close() | 10 // SEMANTICS OF Close() |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 516 |
| 517 std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { | 517 std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { |
| 518 // Constants specified by the ALSA API for device hints. | 518 // Constants specified by the ALSA API for device hints. |
| 519 static const int kGetAllDevices = -1; | 519 static const int kGetAllDevices = -1; |
| 520 static const char kPcmInterfaceName[] = "pcm"; | 520 static const char kPcmInterfaceName[] = "pcm"; |
| 521 static const char kIoHintName[] = "IOID"; | 521 static const char kIoHintName[] = "IOID"; |
| 522 static const char kNameHintName[] = "NAME"; | 522 static const char kNameHintName[] = "NAME"; |
| 523 | 523 |
| 524 const char* wanted_device = GuessSpecificDeviceName(channels); | 524 const char* wanted_device = GuessSpecificDeviceName(channels); |
| 525 if (!wanted_device) | 525 if (!wanted_device) |
| 526 return ""; | 526 return std::string(); |
| 527 | 527 |
| 528 std::string guessed_device; | 528 std::string guessed_device; |
| 529 void** hints = NULL; | 529 void** hints = NULL; |
| 530 int error = wrapper_->DeviceNameHint(kGetAllDevices, | 530 int error = wrapper_->DeviceNameHint(kGetAllDevices, |
| 531 kPcmInterfaceName, | 531 kPcmInterfaceName, |
| 532 &hints); | 532 &hints); |
| 533 if (error == 0) { | 533 if (error == 0) { |
| 534 // NOTE: Do not early return from inside this if statement. The | 534 // NOTE: Do not early return from inside this if statement. The |
| 535 // hints above need to be freed. | 535 // hints above need to be freed. |
| 536 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { | 536 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 760 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 761 // release ownership of the currently registered callback. | 761 // release ownership of the currently registered callback. |
| 762 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 762 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
| 763 DCHECK(IsOnAudioThread()); | 763 DCHECK(IsOnAudioThread()); |
| 764 source_callback_ = callback; | 764 source_callback_ = callback; |
| 765 } | 765 } |
| 766 | 766 |
| 767 } // namespace media | 767 } // namespace media |
| OLD | NEW |