Loading hal/audio_hw.c +19 −35 Original line number Diff line number Diff line Loading @@ -4651,31 +4651,14 @@ static int out_get_presentation_position(const struct audio_stream_out *stream, clock_gettime(CLOCK_MONOTONIC, timestamp); } else { if (out->pcm) { int64_t signed_frames = -1; // XXX it might be better to identify these // as realtime usecases? if (out->usecase == USECASE_AUDIO_PLAYBACK_MMAP || out->usecase == USECASE_AUDIO_PLAYBACK_ULL) { unsigned int hw_ptr; if (pcm_mmap_get_hw_ptr(out->pcm, &hw_ptr, timestamp) == 0) { signed_frames = hw_ptr; } ALOGV("%s frames %lld", __func__, (long long)signed_frames); } else { unsigned int avail; if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) { size_t kernel_buffer_size = out->config.period_size * out->config.period_count; signed_frames = out->written - kernel_buffer_size + avail; } } size_t kernel_buffer_size = out->config.period_size * out->config.period_count; int64_t signed_frames = out->written - kernel_buffer_size + avail; // This adjustment accounts for buffering after app processor. // It is based on estimated DSP latency per use case, rather than exact. signed_frames -= (platform_render_latency(out->usecase) * out->sample_rate / 1000000LL); (platform_render_latency(out->usecase) * out->sample_rate / 1000000LL); // Adjustment accounts for A2dp encoder latency with non offload usecases // Note: Encoder latency is returned in ms, while platform_render_latency in us. Loading @@ -4689,6 +4672,7 @@ static int out_get_presentation_position(const struct audio_stream_out *stream, *frames = signed_frames; ret = 0; } } } else if (out->card_status == CARD_STATUS_OFFLINE) { *frames = out->written; clock_gettime(CLOCK_MONOTONIC, timestamp); Loading Loading
hal/audio_hw.c +19 −35 Original line number Diff line number Diff line Loading @@ -4651,31 +4651,14 @@ static int out_get_presentation_position(const struct audio_stream_out *stream, clock_gettime(CLOCK_MONOTONIC, timestamp); } else { if (out->pcm) { int64_t signed_frames = -1; // XXX it might be better to identify these // as realtime usecases? if (out->usecase == USECASE_AUDIO_PLAYBACK_MMAP || out->usecase == USECASE_AUDIO_PLAYBACK_ULL) { unsigned int hw_ptr; if (pcm_mmap_get_hw_ptr(out->pcm, &hw_ptr, timestamp) == 0) { signed_frames = hw_ptr; } ALOGV("%s frames %lld", __func__, (long long)signed_frames); } else { unsigned int avail; if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) { size_t kernel_buffer_size = out->config.period_size * out->config.period_count; signed_frames = out->written - kernel_buffer_size + avail; } } size_t kernel_buffer_size = out->config.period_size * out->config.period_count; int64_t signed_frames = out->written - kernel_buffer_size + avail; // This adjustment accounts for buffering after app processor. // It is based on estimated DSP latency per use case, rather than exact. signed_frames -= (platform_render_latency(out->usecase) * out->sample_rate / 1000000LL); (platform_render_latency(out->usecase) * out->sample_rate / 1000000LL); // Adjustment accounts for A2dp encoder latency with non offload usecases // Note: Encoder latency is returned in ms, while platform_render_latency in us. Loading @@ -4689,6 +4672,7 @@ static int out_get_presentation_position(const struct audio_stream_out *stream, *frames = signed_frames; ret = 0; } } } else if (out->card_status == CARD_STATUS_OFFLINE) { *frames = out->written; clock_gettime(CLOCK_MONOTONIC, timestamp); Loading