New issue
Advanced search Search tips

Issue 842103 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

CRAS: Device underrun when using cras_test_client to play a low rate file

Project Member Reported by paulhsia@chromium.org, May 11 2018

Issue description

[Problem]
min_cb_level is too low went playing a low rate file with cras_test_client.
Command to reproduce the problem:

sox -n -t raw  -b 16 -r 8000 -c 2 - synth sine 1000 sine 1000 | cras_test_client --playback_f - --rate=8000

===========================
Audio Debug Stats:
-------------devices------------
Output dev: kbl_r5514_5663_max: :0,0
buffer_size: 16384
min_buffer_level: 0
min_cb_level: 40
max_cb_level: 240
frame_rate: 48000
num_channels: 2
est_rate_ratio: 1.000016
num_underruns: 19
num_severe_underruns: 0

-------------stream_dump------------
stream: 50000 dev: 6
direction: Output
stream_type: CRAS_STREAM_TYPE_DEFAULT
buffer_frames: 80
cb_threshold: 40
frame_rate: 8000

[Diagnostic]
stream->cb_threshold is 40 since it has less frame per sec, but when it use for the calculation of iodev's min_cb_level in:
https://cs.corp.google.com/chromeos_public/src/third_party/adhd/cras/src/server/cras_iodev.c?q=min_cb_level&sq=package:%5Echromeos_public$&dr=C&l=768

it should use:

(stream->cb_threshold) * (iodev sample rate) / (stream sample rate)

instead of using:

(stream->cb_threshold).
 
Cc: -dyen@chromium.org dgreid@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, May 14 2018

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

commit 121929e43c3b12e261d9989c36afa89fc7d4907b
Author: paulhsia <paulhsia@chromium.org>
Date: Mon May 14 22:33:07 2018

CRAS: cras_iodev - use converted cb_level to open iodev.

When using a client stream to open io device, if the client stream has a
different frame rate compared to the io device, we should adjust the
cb_level from the stream by the frame rate of the client stream and the
frame rate of the io device.

BUG= chromium:842103 
TEST=sox -n -t raw  -b 16 -r 8000 -c 2 - synth sine 1000 sine 1000 |
cras_test_client --playback_f - --rate=8000 should not hear underrun
TEST=unittest

Change-Id: I3dbefbfe55df47bac547dbb1f1eb1d192553a46a
Reviewed-on: https://chromium-review.googlesource.com/1056780
Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/121929e43c3b12e261d9989c36afa89fc7d4907b/cras/src/tests/iodev_unittest.cc
[modify] https://crrev.com/121929e43c3b12e261d9989c36afa89fc7d4907b/cras/src/server/cras_iodev.c

Status: Verified (was: Assigned)
The bug is fixed after the change.

Sign in to add a comment