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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 void** hints = NULL; | 554 void** hints = NULL; |
555 int error = wrapper_->DeviceNameHint(kGetAllDevices, | 555 int error = wrapper_->DeviceNameHint(kGetAllDevices, |
556 kPcmInterfaceName, | 556 kPcmInterfaceName, |
557 &hints); | 557 &hints); |
558 if (error == 0) { | 558 if (error == 0) { |
559 // NOTE: Do not early return from inside this if statement. The | 559 // NOTE: Do not early return from inside this if statement. The |
560 // hints above need to be freed. | 560 // hints above need to be freed. |
561 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { | 561 for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { |
562 // Only examine devices that are output capable.. Valid values are | 562 // Only examine devices that are output capable.. Valid values are |
563 // "Input", "Output", and NULL which means both input and output. | 563 // "Input", "Output", and NULL which means both input and output. |
564 scoped_ptr<char, base::FreeDeleter> io( | 564 std::unique_ptr<char, base::FreeDeleter> io( |
danakj
2016/04/22 22:47:35
include memory
dcheng
2016/04/22 23:13:19
I shall invoke the style guide here:
"However, any
danakj
2016/04/22 23:15:38
Oh okay I can adjust my algorithm then.
| |
565 wrapper_->DeviceNameGetHint(*hint_iter, kIoHintName)); | 565 wrapper_->DeviceNameGetHint(*hint_iter, kIoHintName)); |
566 if (io != NULL && strcmp(io.get(), "Input") == 0) | 566 if (io != NULL && strcmp(io.get(), "Input") == 0) |
567 continue; | 567 continue; |
568 | 568 |
569 // Attempt to select the closest device for number of channels. | 569 // Attempt to select the closest device for number of channels. |
570 scoped_ptr<char, base::FreeDeleter> name( | 570 std::unique_ptr<char, base::FreeDeleter> name( |
571 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); | 571 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); |
572 if (strncmp(wanted_device, name.get(), strlen(wanted_device)) == 0) { | 572 if (strncmp(wanted_device, name.get(), strlen(wanted_device)) == 0) { |
573 guessed_device = name.get(); | 573 guessed_device = name.get(); |
574 break; | 574 break; |
575 } | 575 } |
576 } | 576 } |
577 | 577 |
578 // Destroy the hint now that we're done with it. | 578 // Destroy the hint now that we're done with it. |
579 wrapper_->DeviceNameFreeHint(hints); | 579 wrapper_->DeviceNameFreeHint(hints); |
580 hints = NULL; | 580 hints = NULL; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 } | 795 } |
796 | 796 |
797 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 797 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
798 // release ownership of the currently registered callback. | 798 // release ownership of the currently registered callback. |
799 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 799 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
800 DCHECK(IsOnAudioThread()); | 800 DCHECK(IsOnAudioThread()); |
801 source_callback_ = callback; | 801 source_callback_ = callback; |
802 } | 802 } |
803 | 803 |
804 } // namespace media | 804 } // namespace media |
OLD | NEW |