Audio: add an openOutputStreamWithFlags API
The existing openOutputStream API did not allow passing stream flags even though its audio hardware interface's open_output_stream counterpart does take a "flags" argument. This means that, when the audio hw_module is implemented using libhardware_legacy, the output flag was lost. This commit adds an API in libhardware_legacy's audio module, allowing to pass the flag, and updates the default wrapper in order to call this new API instead of the old version that missed the flag. Change-Id: I20c102d32b489f87fabbd7d02aa0b28fae13948b Signed-off-by: David Wagner <david.wagner@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com>
This commit is contained in:
parent
600898287d
commit
cc029e59f7
3 changed files with 20 additions and 1 deletions
|
@ -148,6 +148,17 @@ status_t AudioHardwareBase::dumpState(int fd, const Vector<String16>& args)
|
|||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// default implementation calls its "without flags" counterpart
|
||||
AudioStreamOut* AudioHardwareInterface::openOutputStreamWithFlags(uint32_t devices,
|
||||
audio_output_flags_t flags,
|
||||
int *format,
|
||||
uint32_t *channels,
|
||||
uint32_t *sampleRate,
|
||||
status_t *status)
|
||||
{
|
||||
return openOutputStream(devices, format, channels, sampleRate, status);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
}; // namespace android
|
||||
|
|
|
@ -501,7 +501,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
|
||||
devices = convert_audio_device(devices, HAL_API_REV_2_0, HAL_API_REV_1_0);
|
||||
|
||||
out->legacy_out = ladev->hwif->openOutputStream(devices, (int *) &config->format,
|
||||
out->legacy_out = ladev->hwif->openOutputStreamWithFlags(devices, flags,
|
||||
(int *) &config->format,
|
||||
&config->channel_mask,
|
||||
&config->sample_rate, &status);
|
||||
if (!out->legacy_out) {
|
||||
|
|
|
@ -250,6 +250,13 @@ public:
|
|||
uint32_t *channels=0,
|
||||
uint32_t *sampleRate=0,
|
||||
status_t *status=0) = 0;
|
||||
virtual AudioStreamOut* openOutputStreamWithFlags(
|
||||
uint32_t devices,
|
||||
audio_output_flags_t flags=(audio_output_flags_t)0,
|
||||
int *format=0,
|
||||
uint32_t *channels=0,
|
||||
uint32_t *sampleRate=0,
|
||||
status_t *status=0);
|
||||
virtual void closeOutputStream(AudioStreamOut* out) = 0;
|
||||
|
||||
/** This method creates and opens the audio hardware input stream */
|
||||
|
|
Loading…
Reference in a new issue