Merge commit '5b71e6f'

Add an implementation of get_next_write_timestamp.

Change-Id: Ie8e19307bafdb057d06bf3c536380c5740f830a6
This commit is contained in:
Mike Lockwood 2012-03-21 17:43:54 -07:00
commit 584c285492
3 changed files with 23 additions and 0 deletions

View file

@ -70,6 +70,12 @@ AudioStreamOut::~AudioStreamOut()
{
}
// default implementation is unsupported
status_t AudioStreamOut::getNextWriteTimestamp(int64_t *timestamp)
{
return INVALID_OPERATION;
}
AudioStreamIn::~AudioStreamIn() {}
AudioHardwareBase::AudioHardwareBase()
@ -122,6 +128,7 @@ size_t AudioHardwareBase::getInputBufferSize(uint32_t sampleRate, int format, in
return 320;
}
// default implementation is unsupported
status_t AudioHardwareBase::getMasterVolume(float *volume)
{
return INVALID_OPERATION;

View file

@ -163,6 +163,14 @@ static int out_get_render_position(const struct audio_stream_out *stream,
return out->legacy_out->getRenderPosition(dsp_frames);
}
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
int64_t *timestamp)
{
const struct legacy_stream_out *out =
reinterpret_cast<const struct legacy_stream_out *>(stream);
return out->legacy_out->getNextWriteTimestamp(timestamp);
}
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
return 0;
@ -436,6 +444,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->stream.set_volume = out_set_volume;
out->stream.write = out_write;
out->stream.get_render_position = out_get_render_position;
out->stream.get_next_write_timestamp = out_get_next_write_timestamp;
*stream_out = &out->stream;
return 0;

View file

@ -109,6 +109,13 @@ public:
// return the number of audio frames written by the audio dsp to DAC since
// the output has exited standby
virtual status_t getRenderPosition(uint32_t *dspFrames) = 0;
/**
* get the local time at which the next write to the audio driver will be
* presented
*/
virtual status_t getNextWriteTimestamp(int64_t *timestamp);
};
/**