hardware/libaudio
Revision | 96fdbee5d7753ced4fde9ba3a1915977ef2ea9c4 (tree) |
---|---|
Time | 2016-07-27 01:56:44 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
audio_hw: deprecate audio_stream_frame_size()
@@ -497,7 +497,7 @@ static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) | ||
497 | 497 | if (in->resampler != NULL) { |
498 | 498 | in->resampler->resample_from_provider(in->resampler, |
499 | 499 | (int16_t *)((char *)buffer + |
500 | - frames_wr * audio_stream_frame_size(&in->stream.common)), | |
500 | + frames_wr * audio_stream_in_frame_size(&in->stream)), | |
501 | 501 | &frames_rd); |
502 | 502 | } else { |
503 | 503 | struct resampler_buffer buf = { |
@@ -507,9 +507,9 @@ static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) | ||
507 | 507 | get_next_buffer(&in->buf_provider, &buf); |
508 | 508 | if (buf.raw != NULL) { |
509 | 509 | memcpy((char *)buffer + |
510 | - frames_wr * audio_stream_frame_size(&in->stream.common), | |
510 | + frames_wr * audio_stream_in_frame_size(&in->stream), | |
511 | 511 | buf.raw, |
512 | - buf.frame_count * audio_stream_frame_size(&in->stream.common)); | |
512 | + buf.frame_count * audio_stream_in_frame_size(&in->stream)); | |
513 | 513 | frames_rd = buf.frame_count; |
514 | 514 | } |
515 | 515 | release_buffer(&in->buf_provider, &buf); |
@@ -539,7 +539,7 @@ static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) | ||
539 | 539 | static size_t out_get_buffer_size(const struct audio_stream *stream) |
540 | 540 | { |
541 | 541 | return pcm_config_out.period_size * |
542 | - audio_stream_frame_size((struct audio_stream *)stream); | |
542 | + audio_stream_out_frame_size((struct audio_stream_out *)stream); | |
543 | 543 | } |
544 | 544 | |
545 | 545 | 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, | ||
648 | 648 | int ret = 0; |
649 | 649 | struct stream_out *out = (struct stream_out *)stream; |
650 | 650 | struct audio_device *adev = out->dev; |
651 | - size_t frame_size = audio_stream_frame_size(&out->stream.common); | |
651 | + size_t frame_size = audio_stream_out_frame_size(stream); | |
652 | 652 | int16_t *in_buffer = (int16_t *)buffer; |
653 | 653 | size_t in_frames = bytes / frame_size; |
654 | 654 | size_t out_frames; |
@@ -791,7 +791,7 @@ exit: | ||
791 | 791 | |
792 | 792 | if (ret != 0) { |
793 | 793 | ALOGW("out_write error: %d, sleeping...", ret); |
794 | - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / | |
794 | + usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) / | |
795 | 795 | out_get_sample_rate(&stream->common)); |
796 | 796 | } |
797 | 797 |
@@ -847,7 +847,7 @@ static size_t in_get_buffer_size(const struct audio_stream *stream) | ||
847 | 847 | in->pcm_config->rate; |
848 | 848 | size = ((size + 15) / 16) * 16; |
849 | 849 | |
850 | - return size * audio_stream_frame_size((struct audio_stream *)stream); | |
850 | + return size * audio_stream_in_frame_size(&in->stream); | |
851 | 851 | } |
852 | 852 | |
853 | 853 | 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, | ||
938 | 938 | int ret = 0; |
939 | 939 | struct stream_in *in = (struct stream_in *)stream; |
940 | 940 | struct audio_device *adev = in->dev; |
941 | - size_t frames_rq = bytes / audio_stream_frame_size(&stream->common); | |
941 | + size_t frames_rq = bytes / audio_stream_in_frame_size(stream); | |
942 | 942 | |
943 | 943 | /* |
944 | 944 | * 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, | ||
991 | 991 | |
992 | 992 | exit: |
993 | 993 | if (ret < 0) |
994 | - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / | |
994 | + usleep(bytes * 1000000 / audio_stream_in_frame_size(stream) / | |
995 | 995 | in_get_sample_rate(&stream->common)); |
996 | 996 | |
997 | 997 | pthread_mutex_unlock(&in->lock); |