summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 6f14e1e..88b4be6 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1438,7 +1438,7 @@ static int start_output_stream_low_latency(struct tuna_stream_out *out)
if (success) {
out->buffer_frames = pcm_config_tones.period_size * 2;
if (out->buffer == NULL)
- out->buffer = malloc(out->buffer_frames * audio_stream_frame_size(&out->stream.common));
+ out->buffer = malloc(out->buffer_frames * audio_stream_out_frame_size(&out->stream));
if (adev->echo_reference != NULL)
out->echo_reference = adev->echo_reference;
@@ -1474,7 +1474,7 @@ static int start_output_stream_deep_buffer(struct tuna_stream_out *out)
}
out->buffer_frames = DEEP_BUFFER_SHORT_PERIOD_SIZE * 2;
if (out->buffer == NULL)
- out->buffer = malloc(out->buffer_frames * audio_stream_frame_size(&out->stream.common));
+ out->buffer = malloc(out->buffer_frames * audio_stream_out_frame_size(&out->stream));
return 0;
}
@@ -1669,7 +1669,7 @@ static size_t out_get_buffer_size_low_latency(const struct audio_stream *stream)
from pcm_config_tones.rate. */
size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_tones.rate;
size = ((size + 15) / 16) * 16;
- return size * audio_stream_frame_size((struct audio_stream *)stream);
+ return size * audio_stream_out_frame_size((const struct audio_stream_out *)stream);
}
static size_t out_get_buffer_size_deep_buffer(const struct audio_stream *stream)
@@ -1683,12 +1683,12 @@ static size_t out_get_buffer_size_deep_buffer(const struct audio_stream *stream)
size_t size = (DEEP_BUFFER_SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) /
pcm_config_mm.rate;
size = ((size + 15) / 16) * 16;
- return size * audio_stream_frame_size((struct audio_stream *)stream);
+ return size * audio_stream_out_frame_size((const struct audio_stream_out *)stream);
}
static size_t out_get_buffer_size_hdmi(const struct audio_stream *stream)
{
- return HDMI_MULTI_PERIOD_SIZE * audio_stream_frame_size((struct audio_stream *)stream);
+ return HDMI_MULTI_PERIOD_SIZE * audio_stream_out_frame_size((const struct audio_stream_out *)stream);
}
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
@@ -1935,7 +1935,7 @@ static ssize_t out_write_low_latency(struct audio_stream_out *stream, const void
int ret;
struct tuna_stream_out *out = (struct tuna_stream_out *)stream;
struct tuna_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);
size_t in_frames = bytes / frame_size;
size_t out_frames = in_frames;
bool force_input_standby = false;
@@ -2003,7 +2003,7 @@ exit:
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
- usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
+ usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate(&stream->common));
}
@@ -2027,7 +2027,7 @@ static ssize_t out_write_deep_buffer(struct audio_stream_out *stream, const void
int ret;
struct tuna_stream_out *out = (struct tuna_stream_out *)stream;
struct tuna_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(&out->stream);
size_t in_frames = bytes / frame_size;
size_t out_frames;
bool use_long_periods;
@@ -2106,7 +2106,7 @@ exit:
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
- usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
+ usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate(&stream->common));
}
@@ -2119,7 +2119,7 @@ static ssize_t out_write_hdmi(struct audio_stream_out *stream, const void* buffe
int ret;
struct tuna_stream_out *out = (struct tuna_stream_out *)stream;
struct tuna_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(&out->stream);
size_t in_frames = bytes / frame_size;
/* acquiring hw device mutex systematically is useful if a low priority thread is waiting
@@ -2149,7 +2149,7 @@ exit:
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
- usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
+ usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate_hdmi(&stream->common));
}
/* FIXME: workaround for HDMI multi channel channel swap on first playback after opening
@@ -2761,13 +2761,12 @@ static ssize_t process_frames(struct tuna_stream_in *in, void* buffer, ssize_t f
}
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
-
size_t bytes)
{
int ret = 0;
struct tuna_stream_in *in = (struct tuna_stream_in *)stream;
struct tuna_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 priority thread is waiting
* on the input stream mutex - e.g. executing select_mode() while holding the hw device
@@ -2800,7 +2799,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);