summaryrefslogtreecommitdiff
path: root/cras/src/tests/bt_io_unittest.cc
diff options
context:
space:
mode:
authorJohn Muir <muirj@google.com>2016-07-31 14:57:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-10 22:48:08 -0700
commitfa4cd9766aec6eae544b1078ed835687c4e74617 (patch)
tree44ad64a844430ce48c424e943795accedb61b943 /cras/src/tests/bt_io_unittest.cc
parent654d8e6e44b31384dc62259c990bfff347391f74 (diff)
downloadadhd-fa4cd9766aec6eae544b1078ed835687c4e74617.tar.gz
CRAS: Use the hardware timestamp with available/used frames.
The ALSA device drivers can provide a timestamp associated with the buffer read-pointer. This can be use to more accurately guage the time that the next buffer is required. Enable this functionality only when supported ALSA in the running kernel. BUG=None TEST=Unit tests pass. Verified on Samus (on kernel v3.14). Verified on new device (kernel v3.18 - htimestamp enabled). Verified a bluetooth device. Verified a USB device. Change-Id: I5bca36f7ad9a236e80b2e277ccc62ccc8c39905b Reviewed-on: https://chromium-review.googlesource.com/366961 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'cras/src/tests/bt_io_unittest.cc')
-rw-r--r--cras/src/tests/bt_io_unittest.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/cras/src/tests/bt_io_unittest.cc b/cras/src/tests/bt_io_unittest.cc
index 5e66f31a..979404ac 100644
--- a/cras/src/tests/bt_io_unittest.cc
+++ b/cras/src/tests/bt_io_unittest.cc
@@ -98,7 +98,8 @@ class BtIoBasicSuite : public testing::Test {
update_supported_formats_called_++;
return 0;
}
- static int frames_queued(const cras_iodev* iodev) {
+ static int frames_queued(const cras_iodev* iodev,
+ struct timespec *tstamp) {
frames_queued_called_++;
return 0;
}
@@ -152,6 +153,7 @@ unsigned int BtIoBasicSuite::close_dev_called_;
TEST_F(BtIoBasicSuite, CreateBtIo) {
struct cras_audio_area *fake_area;
struct cras_audio_format fake_fmt;
+ struct timespec tstamp;
unsigned fr;
bt_iodev = cras_bt_io_create(fake_device, &iodev_,
CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
@@ -164,7 +166,7 @@ TEST_F(BtIoBasicSuite, CreateBtIo) {
bt_iodev->open_dev(bt_iodev);
EXPECT_EQ(1, open_dev_called_);
- bt_iodev->frames_queued(bt_iodev);
+ bt_iodev->frames_queued(bt_iodev, &tstamp);
EXPECT_EQ(1, frames_queued_called_);
bt_iodev->get_buffer(bt_iodev, &fake_area, &fr);
EXPECT_EQ(1, get_buffer_called_);