New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 845051 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Sep 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

samus: audio_CRASFormatConversion failure

Project Member Reported by yuhsuan@chromium.org, May 21 2018

Issue description

It happens when we want to leave no stream. If it's not in free running yet, it will not adjust appl_ptr. It causes we need to play all of zero samples in device buffer.
I created a CL to fix it. Now it can pass CRASFormatConversion test reliably. 
https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/1065482
Project Member

Comment 3 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/cf87501cd6e1ad9c441e02797e63e36f23688baa

commit cf87501cd6e1ad9c441e02797e63e36f23688baa
Author: Yu-hsuan Hsu <yuhsuan@google.com>
Date: Tue May 29 09:24:11 2018

CRAS: cras_alsa_io - Adjust appl_ptr correctly when leave no stream

If we get into leave_free_run funcion before it becomes free run state,
it will do nothing and appl_ptr won't be changed. It causes we need to
play all of zero samples in device buffer. The next audio stream will
have very long delay.

We should fix it by adjust appl_ptr to correct position. First, we can
use hw_level minus zeros filled before to get how many valid samples
remaining. Then we compare it with the original offset we want to set
(min_cb_level + min_buffer_level).

(1) If valid_sample >= min_buffer_level + min_cb_level, new offset is the
same as valid_sample.

(2) If valid_sample < min_buffer_level + min_cb_level, we retain original
offset and fill zeros after valid samples if we don't have enough zero
samples in device buffer.

BUG= chromium:845051 
TEST=pass audio_CRASFormatConversion test reliably.
TEST=unittest

Change-Id: Ia9a89f617c5f06b0da3585b816136aefb8a0f179
Reviewed-on: https://chromium-review.googlesource.com/1065482
Commit-Ready: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/cf87501cd6e1ad9c441e02797e63e36f23688baa/cras/src/tests/alsa_io_unittest.cc
[modify] https://crrev.com/cf87501cd6e1ad9c441e02797e63e36f23688baa/cras/src/server/cras_alsa_io.c

Status: Fixed (was: Assigned)
Labels: Merge-Request-68
The CL is merged for a while and it's pretty safe.
Need to merge the change to R68 to fix this bug trigger by http://crrev.com/c/1053620, which is merged in R68.

The bug might cause some serious audio delay.

Thanks!
Owner: paulhsia@chromium.org
Status: Started (was: Fixed)
Cc: bhthompson@chromium.org
Labels: -Merge-Request-68 Merge-Approved-68
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 22

Labels: merge-merged-stabilize-10718.88.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/58fcac609dd6d7fd2835f76281f015eabd892778

commit 58fcac609dd6d7fd2835f76281f015eabd892778
Author: Yu-hsuan Hsu <yuhsuan@google.com>
Date: Wed Aug 22 07:24:56 2018

CRAS: cras_alsa_io - Adjust appl_ptr correctly when leave no stream

If we get into leave_free_run funcion before it becomes free run state,
it will do nothing and appl_ptr won't be changed. It causes we need to
play all of zero samples in device buffer. The next audio stream will
have very long delay.

We should fix it by adjust appl_ptr to correct position. First, we can
use hw_level minus zeros filled before to get how many valid samples
remaining. Then we compare it with the original offset we want to set
(min_cb_level + min_buffer_level).

(1) If valid_sample >= min_buffer_level + min_cb_level, new offset is the
same as valid_sample.

(2) If valid_sample < min_buffer_level + min_cb_level, we retain original
offset and fill zeros after valid samples if we don't have enough zero
samples in device buffer.

BUG= chromium:845051 
BUG=b:112621593
TEST=pass audio_CRASFormatConversion test reliably.
TEST=unittest

Change-Id: Ia9a89f617c5f06b0da3585b816136aefb8a0f179
Previous-Reviewed-on: https://chromium-review.googlesource.com/1065482
(cherry picked from commit 0b34b8cd6049f4a61102112003a37833a7d45261)
Reviewed-on: https://chromium-review.googlesource.com/1184661
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>

[modify] https://crrev.com/58fcac609dd6d7fd2835f76281f015eabd892778/cras/src/tests/alsa_io_unittest.cc
[modify] https://crrev.com/58fcac609dd6d7fd2835f76281f015eabd892778/cras/src/server/cras_alsa_io.c

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 22

Labels: merge-merged-release-R68-10718.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/72769d06de999d2be430845adc1966a2557ee7b0

commit 72769d06de999d2be430845adc1966a2557ee7b0
Author: Yu-hsuan Hsu <yuhsuan@google.com>
Date: Wed Aug 22 07:24:57 2018

CRAS: cras_alsa_io - Adjust appl_ptr correctly when leave no stream

If we get into leave_free_run funcion before it becomes free run state,
it will do nothing and appl_ptr won't be changed. It causes we need to
play all of zero samples in device buffer. The next audio stream will
have very long delay.

We should fix it by adjust appl_ptr to correct position. First, we can
use hw_level minus zeros filled before to get how many valid samples
remaining. Then we compare it with the original offset we want to set
(min_cb_level + min_buffer_level).

(1) If valid_sample >= min_buffer_level + min_cb_level, new offset is the
same as valid_sample.

(2) If valid_sample < min_buffer_level + min_cb_level, we retain original
offset and fill zeros after valid samples if we don't have enough zero
samples in device buffer.

BUG= chromium:845051 
BUG=b:112621593
TEST=pass audio_CRASFormatConversion test reliably.
TEST=unittest

Change-Id: Ia9a89f617c5f06b0da3585b816136aefb8a0f179
Previous-Reviewed-on: https://chromium-review.googlesource.com/1065482
(cherry picked from commit 0b34b8cd6049f4a61102112003a37833a7d45261)
Reviewed-on: https://chromium-review.googlesource.com/1183660
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>

[modify] https://crrev.com/72769d06de999d2be430845adc1966a2557ee7b0/cras/src/tests/alsa_io_unittest.cc
[modify] https://crrev.com/72769d06de999d2be430845adc1966a2557ee7b0/cras/src/server/cras_alsa_io.c

Labels: -Merge-Approved-68 Merge-Merged
Status: Verified (was: Started)
Problem solved. Close the issue.

Sign in to add a comment