AudioFlinger: call SPDIF wrapper from AudioFlinger
Create an interface layer between the AudioFlinger and the HAL
that manages the wrapping and format conversion.
Removed unnecessary includes.
Handle rate conversion in getRenderPosition().
Try to open HAL with encoded format before wrapping with SPDIF.
Bug: 17566660
Change-Id: I00ad888ca15ff0f85b85efb8167c7f5ea761a244
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 461b5d3..f3206cb 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -272,7 +272,7 @@
};
#define ARRAY_SIZE(x) (sizeof((x))/sizeof(((x)[0])))
-AudioFlinger::AudioHwDevice* AudioFlinger::findSuitableHwDev_l(
+AudioHwDevice* AudioFlinger::findSuitableHwDev_l(
audio_module_handle_t module,
audio_devices_t devices)
{
@@ -1716,8 +1716,6 @@
mHardwareStatus = AUDIO_HW_OUTPUT_OPEN;
- audio_stream_out_t *outStream = NULL;
-
// FOR TESTING ONLY:
// This if statement allows overriding the audio policy settings
// and forcing a specific format or channel mask to the HAL/Sink device for testing.
@@ -1739,25 +1737,18 @@
}
}
- status_t status = hwDevHal->open_output_stream(hwDevHal,
- *output,
- devices,
- flags,
- config,
- &outStream,
- address.string());
+ AudioStreamOut *outputStream = NULL;
+ status_t status = outHwDev->openOutputStream(
+ &outputStream,
+ *output,
+ devices,
+ flags,
+ config,
+ address.string());
mHardwareStatus = AUDIO_HW_IDLE;
- ALOGV("openOutput_l() openOutputStream returned output %p, sampleRate %d, Format %#x, "
- "channelMask %#x, status %d",
- outStream,
- config->sample_rate,
- config->format,
- config->channel_mask,
- status);
- if (status == NO_ERROR && outStream != NULL) {
- AudioStreamOut *outputStream = new AudioStreamOut(outHwDev, outStream, flags);
+ if (status == NO_ERROR) {
PlaybackThread *thread;
if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
@@ -1787,7 +1778,7 @@
uint32_t *latencyMs,
audio_output_flags_t flags)
{
- ALOGV("openOutput(), module %d Device %x, SamplingRate %d, Format %#08x, Channels %x, flags %x",
+ ALOGI("openOutput(), module %d Device %x, SamplingRate %d, Format %#08x, Channels %x, flags %x",
module,
(devices != NULL) ? *devices : 0,
config->sample_rate,