From 96fdbee5d7753ced4fde9ba3a1915977ef2ea9c4 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Wed, 27 Jul 2016 00:56:44 +0800 Subject: audio_hw: deprecate audio_stream_frame_size() --- audio_hw.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/audio_hw.c b/audio_hw.c index e390cc7..9ff00e1 100644 --- a/audio_hw.c +++ b/audio_hw.c @@ -497,7 +497,7 @@ static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) if (in->resampler != NULL) { in->resampler->resample_from_provider(in->resampler, (int16_t *)((char *)buffer + - frames_wr * audio_stream_frame_size(&in->stream.common)), + frames_wr * audio_stream_in_frame_size(&in->stream)), &frames_rd); } else { struct resampler_buffer buf = { @@ -507,9 +507,9 @@ static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) get_next_buffer(&in->buf_provider, &buf); if (buf.raw != NULL) { memcpy((char *)buffer + - frames_wr * audio_stream_frame_size(&in->stream.common), + frames_wr * audio_stream_in_frame_size(&in->stream), buf.raw, - buf.frame_count * audio_stream_frame_size(&in->stream.common)); + buf.frame_count * audio_stream_in_frame_size(&in->stream)); frames_rd = buf.frame_count; } release_buffer(&in->buf_provider, &buf); @@ -539,7 +539,7 @@ static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) static size_t out_get_buffer_size(const struct audio_stream *stream) { return pcm_config_out.period_size * - audio_stream_frame_size((struct audio_stream *)stream); + audio_stream_out_frame_size((struct audio_stream_out *)stream); } static uint32_t out_get_channels(const struct audio_stream *stream) @@ -648,7 +648,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, int ret = 0; struct stream_out *out = (struct stream_out *)stream; struct audio_device *adev = out->dev; - size_t frame_size = audio_stream_frame_size(&out->stream.common); + size_t frame_size = audio_stream_out_frame_size(stream); int16_t *in_buffer = (int16_t *)buffer; size_t in_frames = bytes / frame_size; size_t out_frames; @@ -791,7 +791,7 @@ exit: if (ret != 0) { ALOGW("out_write error: %d, sleeping...", ret); - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) / out_get_sample_rate(&stream->common)); } @@ -847,7 +847,7 @@ static size_t in_get_buffer_size(const struct audio_stream *stream) in->pcm_config->rate; size = ((size + 15) / 16) * 16; - return size * audio_stream_frame_size((struct audio_stream *)stream); + return size * audio_stream_in_frame_size(&in->stream); } static uint32_t in_get_channels(const struct audio_stream *stream) @@ -938,7 +938,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, int ret = 0; struct stream_in *in = (struct stream_in *)stream; struct audio_device *adev = in->dev; - size_t frames_rq = bytes / audio_stream_frame_size(&stream->common); + size_t frames_rq = bytes / audio_stream_in_frame_size(stream); /* * acquiring hw device mutex systematically is useful if a low @@ -991,7 +991,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, exit: if (ret < 0) - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_in_frame_size(stream) / in_get_sample_rate(&stream->common)); pthread_mutex_unlock(&in->lock); -- cgit v1.2.3