| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 void** hints = NULL; | 528 void** hints = NULL; |
| 529 int error = wrapper_->DeviceNameHint(kGetAllDevices, | 529 int error = wrapper_->DeviceNameHint(kGetAllDevices, |
| 530 kPcmInterfaceName, | 530 kPcmInterfaceName, |
| 531 &hints); | 531 &hints); |
| 532 if (error == 0) { | 532 if (error == 0) { |
| 533 // NOTE: Do not early return from inside this if statement. The | 533 // NOTE: Do not early return from inside this if statement. The |
| 534 // hints above need to be freed. | 534 // hints above need to be freed. |
| 535 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { | 535 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { |
| 536 // Only examine devices that are output capable.. Valid values are | 536 // Only examine devices that are output capable.. Valid values are |
| 537 // "Input", "Output", and NULL which means both input and output. | 537 // "Input", "Output", and NULL which means both input and output. |
| 538 scoped_ptr_malloc<char> io( | 538 scoped_ptr<char, base::FreeDeleter> io( |
| 539 wrapper_->DeviceNameGetHint(*hint_iter, kIoHintName)); | 539 wrapper_->DeviceNameGetHint(*hint_iter, kIoHintName)); |
| 540 if (io != NULL && strcmp(io.get(), "Input") == 0) | 540 if (io != NULL && strcmp(io.get(), "Input") == 0) |
| 541 continue; | 541 continue; |
| 542 | 542 |
| 543 // Attempt to select the closest device for number of channels. | 543 // Attempt to select the closest device for number of channels. |
| 544 scoped_ptr_malloc<char> name( | 544 scoped_ptr<char, base::FreeDeleter> name( |
| 545 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); | 545 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); |
| 546 if (strncmp(wanted_device, name.get(), strlen(wanted_device)) == 0) { | 546 if (strncmp(wanted_device, name.get(), strlen(wanted_device)) == 0) { |
| 547 guessed_device = name.get(); | 547 guessed_device = name.get(); |
| 548 break; | 548 break; |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 // Destroy the hint now that we're done with it. | 552 // Destroy the hint now that we're done with it. |
| 553 wrapper_->DeviceNameFreeHint(hints); | 553 wrapper_->DeviceNameFreeHint(hints); |
| 554 hints = NULL; | 554 hints = NULL; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 755 } |
| 756 | 756 |
| 757 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 757 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 758 // release ownership of the currently registered callback. | 758 // release ownership of the currently registered callback. |
| 759 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 759 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
| 760 DCHECK(IsOnAudioThread()); | 760 DCHECK(IsOnAudioThread()); |
| 761 source_callback_ = callback; | 761 source_callback_ = callback; |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace media | 764 } // namespace media |
| OLD | NEW |