• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <gtest/gtest.h>
6 
7 extern "C" {
8 
9 // To test static functions.
10 #include "cras_bt_io.c"
11 #include "utlist.h"
12 }
13 
14 static struct cras_bt_device* fake_device =
15     reinterpret_cast<struct cras_bt_device*>(0x123);
16 static unsigned int cras_iodev_add_node_called;
17 static unsigned int cras_iodev_rm_node_called;
18 static unsigned int cras_iodev_free_format_called;
19 static unsigned int cras_iodev_free_resources_called;
20 static unsigned int cras_iodev_set_active_node_called;
21 static unsigned int cras_iodev_list_add_output_called;
22 static unsigned int cras_iodev_list_rm_output_called;
23 static unsigned int cras_iodev_list_add_input_called;
24 static unsigned int cras_iodev_list_rm_input_called;
25 static unsigned int cras_bt_device_set_active_profile_called;
26 static unsigned int cras_bt_device_set_active_profile_val;
27 static int cras_bt_device_get_active_profile_ret;
28 static int cras_bt_device_switch_profile_enable_dev_called;
29 static int cras_bt_device_switch_profile_called;
30 static int cras_bt_device_can_switch_to_a2dp_ret;
31 static int cras_bt_device_has_a2dp_ret;
32 static int is_utf8_string_ret_value;
33 
ResetStubData()34 void ResetStubData() {
35   cras_iodev_add_node_called = 0;
36   cras_iodev_rm_node_called = 0;
37   cras_iodev_free_format_called = 0;
38   cras_iodev_free_resources_called = 0;
39   cras_iodev_set_active_node_called = 0;
40   cras_iodev_list_add_output_called = 0;
41   cras_iodev_list_rm_output_called = 0;
42   cras_iodev_list_add_input_called = 0;
43   cras_iodev_list_rm_input_called = 0;
44   cras_bt_device_set_active_profile_called = 0;
45   cras_bt_device_set_active_profile_val = 0;
46   cras_bt_device_get_active_profile_ret = 0;
47   cras_bt_device_switch_profile_enable_dev_called = 0;
48   cras_bt_device_switch_profile_called = 0;
49   cras_bt_device_can_switch_to_a2dp_ret = 0;
50   cras_bt_device_has_a2dp_ret = 0;
51   is_utf8_string_ret_value = 1;
52 }
53 
54 namespace {
55 
56 class BtIoBasicSuite : public testing::Test {
57  protected:
SetUp()58   virtual void SetUp() {
59     ResetStubData();
60     SetUpIodev(&iodev_, CRAS_STREAM_OUTPUT);
61     SetUpIodev(&iodev2_, CRAS_STREAM_OUTPUT);
62     iodev_.active_node = &node_;
63     iodev2_.active_node = &node2_;
64 
65     update_supported_formats_called_ = 0;
66     frames_queued_called_ = 0;
67     delay_frames_called_ = 0;
68     get_buffer_called_ = 0;
69     put_buffer_called_ = 0;
70     configure_dev_called_ = 0;
71     close_dev_called_ = 0;
72   }
73 
TearDown()74   virtual void TearDown() {}
75 
SetUpIodev(struct cras_iodev * d,enum CRAS_STREAM_DIRECTION dir)76   static void SetUpIodev(struct cras_iodev* d, enum CRAS_STREAM_DIRECTION dir) {
77     d->direction = dir;
78     d->update_supported_formats = update_supported_formats;
79     d->frames_queued = frames_queued;
80     d->delay_frames = delay_frames;
81     d->get_buffer = get_buffer;
82     d->put_buffer = put_buffer;
83     d->configure_dev = configure_dev;
84     d->close_dev = close_dev;
85     d->supported_rates = NULL;
86     d->supported_channel_counts = NULL;
87     d->supported_formats = NULL;
88   }
89 
90   // Stub functions for the iodev structure.
update_supported_formats(struct cras_iodev * iodev)91   static int update_supported_formats(struct cras_iodev* iodev) {
92     free(iodev->supported_rates);
93     free(iodev->supported_channel_counts);
94     free(iodev->supported_formats);
95     iodev->supported_rates =
96         (size_t*)calloc(2, sizeof(*iodev->supported_rates));
97     iodev->supported_rates[0] = 48000;
98     iodev->supported_rates[1] = 0;
99     iodev->supported_channel_counts =
100         (size_t*)calloc(2, sizeof(*iodev->supported_channel_counts));
101     iodev->supported_channel_counts[0] = 2;
102     iodev->supported_channel_counts[1] = 0;
103     iodev->supported_formats =
104         (snd_pcm_format_t*)calloc(2, sizeof(*iodev->supported_formats));
105     iodev->supported_formats[0] = SND_PCM_FORMAT_S16_LE;
106     iodev->supported_formats[1] = (snd_pcm_format_t)0;
107     update_supported_formats_called_++;
108     return 0;
109   }
frames_queued(const cras_iodev * iodev,struct timespec * tstamp)110   static int frames_queued(const cras_iodev* iodev, struct timespec* tstamp) {
111     frames_queued_called_++;
112     return 0;
113   }
delay_frames(const cras_iodev * iodev)114   static int delay_frames(const cras_iodev* iodev) {
115     delay_frames_called_++;
116     return 0;
117   }
get_buffer(cras_iodev * iodev,struct cras_audio_area ** area,unsigned int * num)118   static int get_buffer(cras_iodev* iodev,
119                         struct cras_audio_area** area,
120                         unsigned int* num) {
121     get_buffer_called_++;
122     return 0;
123   }
put_buffer(cras_iodev * iodev,unsigned int num)124   static int put_buffer(cras_iodev* iodev, unsigned int num) {
125     put_buffer_called_++;
126     return 0;
127   }
configure_dev(cras_iodev * iodev)128   static int configure_dev(cras_iodev* iodev) {
129     configure_dev_called_++;
130     return 0;
131   }
close_dev(cras_iodev * iodev)132   static int close_dev(cras_iodev* iodev) {
133     free(iodev->format);
134     iodev->format = NULL;
135     close_dev_called_++;
136     return 0;
137   }
138 
139   static struct cras_iodev* bt_iodev;
140   static struct cras_iodev iodev_;
141   static struct cras_iodev iodev2_;
142   static struct cras_ionode node_;
143   static struct cras_ionode node2_;
144   static unsigned int update_supported_formats_called_;
145   static unsigned int frames_queued_called_;
146   static unsigned int delay_frames_called_;
147   static unsigned int get_buffer_called_;
148   static unsigned int put_buffer_called_;
149   static unsigned int configure_dev_called_;
150   static unsigned int close_dev_called_;
151 };
152 
153 struct cras_iodev* BtIoBasicSuite::bt_iodev;
154 struct cras_iodev BtIoBasicSuite::iodev_;
155 struct cras_iodev BtIoBasicSuite::iodev2_;
156 struct cras_ionode BtIoBasicSuite::node_;
157 struct cras_ionode BtIoBasicSuite::node2_;
158 unsigned int BtIoBasicSuite::update_supported_formats_called_;
159 unsigned int BtIoBasicSuite::frames_queued_called_;
160 unsigned int BtIoBasicSuite::delay_frames_called_;
161 unsigned int BtIoBasicSuite::get_buffer_called_;
162 unsigned int BtIoBasicSuite::put_buffer_called_;
163 unsigned int BtIoBasicSuite::configure_dev_called_;
164 unsigned int BtIoBasicSuite::close_dev_called_;
165 
TEST_F(BtIoBasicSuite,CreateBtIo)166 TEST_F(BtIoBasicSuite, CreateBtIo) {
167   struct cras_audio_area* fake_area;
168   struct cras_audio_format fake_fmt;
169   struct timespec tstamp;
170   unsigned fr;
171   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
172                                CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
173   EXPECT_NE((void*)NULL, bt_iodev);
174   EXPECT_EQ(&iodev_, active_profile_dev(bt_iodev));
175   EXPECT_EQ(1, cras_iodev_list_add_output_called);
176   bt_iodev->open_dev(bt_iodev);
177   bt_iodev->format = &fake_fmt;
178   bt_iodev->update_supported_formats(bt_iodev);
179   EXPECT_EQ(1, update_supported_formats_called_);
180 
181   bt_iodev->state = CRAS_IODEV_STATE_OPEN;
182   bt_iodev->configure_dev(bt_iodev);
183   EXPECT_EQ(1, configure_dev_called_);
184   bt_iodev->frames_queued(bt_iodev, &tstamp);
185   EXPECT_EQ(1, frames_queued_called_);
186   bt_iodev->get_buffer(bt_iodev, &fake_area, &fr);
187   EXPECT_EQ(1, get_buffer_called_);
188   bt_iodev->put_buffer(bt_iodev, fr);
189   EXPECT_EQ(1, put_buffer_called_);
190   bt_iodev->close_dev(bt_iodev);
191   EXPECT_EQ(1, close_dev_called_);
192   EXPECT_EQ(1, cras_iodev_free_format_called);
193   cras_bt_io_destroy(bt_iodev);
194   EXPECT_EQ(1, cras_iodev_free_resources_called);
195   EXPECT_EQ(1, cras_iodev_list_rm_output_called);
196 
197   free(iodev_.supported_rates);
198   free(iodev_.supported_channel_counts);
199   free(iodev_.supported_formats);
200 }
201 
TEST_F(BtIoBasicSuite,SwitchProfileOnOpenDevForInputDev)202 TEST_F(BtIoBasicSuite, SwitchProfileOnOpenDevForInputDev) {
203   ResetStubData();
204   iodev_.direction = CRAS_STREAM_INPUT;
205   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
206                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
207 
208   cras_bt_device_get_active_profile_ret = CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE;
209   bt_iodev->open_dev(bt_iodev);
210 
211   EXPECT_EQ(CRAS_BT_DEVICE_PROFILE_HSP_AUDIOGATEWAY |
212                 CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY,
213             cras_bt_device_set_active_profile_val);
214   EXPECT_EQ(1, cras_bt_device_switch_profile_enable_dev_called);
215   cras_bt_io_destroy(bt_iodev);
216 }
217 
TEST_F(BtIoBasicSuite,NoSwitchProfileOnOpenDevForInputDevAlreadyOnHfp)218 TEST_F(BtIoBasicSuite, NoSwitchProfileOnOpenDevForInputDevAlreadyOnHfp) {
219   ResetStubData();
220   iodev_.direction = CRAS_STREAM_INPUT;
221   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
222                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
223 
224   /* No need to switch profile if already on HFP. */
225   cras_bt_device_get_active_profile_ret =
226       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY;
227   bt_iodev->open_dev(bt_iodev);
228 
229   EXPECT_EQ(0, cras_bt_device_switch_profile_enable_dev_called);
230   cras_bt_io_destroy(bt_iodev);
231 }
232 
TEST_F(BtIoBasicSuite,SwitchProfileOnCloseInputDev)233 TEST_F(BtIoBasicSuite, SwitchProfileOnCloseInputDev) {
234   ResetStubData();
235   iodev_.direction = CRAS_STREAM_INPUT;
236   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
237                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
238   bt_iodev->state = CRAS_IODEV_STATE_OPEN;
239 
240   cras_bt_device_get_active_profile_ret =
241       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY |
242       CRAS_BT_DEVICE_PROFILE_HSP_AUDIOGATEWAY;
243   cras_bt_device_has_a2dp_ret = 1;
244   bt_iodev->close_dev(bt_iodev);
245 
246   EXPECT_EQ(CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE,
247             cras_bt_device_set_active_profile_val);
248   EXPECT_EQ(1, cras_bt_device_switch_profile_called);
249   cras_bt_io_destroy(bt_iodev);
250 }
251 
TEST_F(BtIoBasicSuite,NoSwitchProfileOnCloseInputDevNoSupportA2dp)252 TEST_F(BtIoBasicSuite, NoSwitchProfileOnCloseInputDevNoSupportA2dp) {
253   ResetStubData();
254   iodev_.direction = CRAS_STREAM_INPUT;
255   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
256                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
257   bt_iodev->state = CRAS_IODEV_STATE_OPEN;
258 
259   cras_bt_device_get_active_profile_ret =
260       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY |
261       CRAS_BT_DEVICE_PROFILE_HSP_AUDIOGATEWAY;
262   cras_bt_device_has_a2dp_ret = 0;
263   bt_iodev->close_dev(bt_iodev);
264 
265   EXPECT_EQ(0, cras_bt_device_switch_profile_called);
266   cras_bt_io_destroy(bt_iodev);
267 }
268 
TEST_F(BtIoBasicSuite,NoSwitchProfileOnCloseInputDevInCloseState)269 TEST_F(BtIoBasicSuite, NoSwitchProfileOnCloseInputDevInCloseState) {
270   ResetStubData();
271   iodev_.direction = CRAS_STREAM_INPUT;
272   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
273                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
274   bt_iodev->state = CRAS_IODEV_STATE_CLOSE;
275 
276   cras_bt_device_get_active_profile_ret =
277       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY |
278       CRAS_BT_DEVICE_PROFILE_HSP_AUDIOGATEWAY;
279   cras_bt_device_has_a2dp_ret = 1;
280   bt_iodev->close_dev(bt_iodev);
281 
282   EXPECT_EQ(0, cras_bt_device_switch_profile_called);
283   cras_bt_io_destroy(bt_iodev);
284 }
285 
TEST_F(BtIoBasicSuite,SwitchProfileOnAppendA2dpDev)286 TEST_F(BtIoBasicSuite, SwitchProfileOnAppendA2dpDev) {
287   ResetStubData();
288   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
289                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
290 
291   cras_bt_device_can_switch_to_a2dp_ret = 1;
292   cras_bt_io_append(bt_iodev, &iodev2_, CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
293 
294   EXPECT_EQ(CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE,
295             cras_bt_device_set_active_profile_val);
296   EXPECT_EQ(0, cras_bt_device_switch_profile_enable_dev_called);
297   EXPECT_EQ(1, cras_bt_device_switch_profile_called);
298   cras_bt_io_destroy(bt_iodev);
299 }
300 
TEST_F(BtIoBasicSuite,NoSwitchProfileOnAppendHfpDev)301 TEST_F(BtIoBasicSuite, NoSwitchProfileOnAppendHfpDev) {
302   ResetStubData();
303   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
304                                CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
305 
306   cras_bt_device_can_switch_to_a2dp_ret = 1;
307   cras_bt_io_append(bt_iodev, &iodev2_,
308                     CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
309 
310   EXPECT_EQ(0, cras_bt_device_switch_profile_enable_dev_called);
311   cras_bt_io_destroy(bt_iodev);
312 }
313 
TEST_F(BtIoBasicSuite,CreateSetDeviceActiveProfileToA2DP)314 TEST_F(BtIoBasicSuite, CreateSetDeviceActiveProfileToA2DP) {
315   ResetStubData();
316   cras_bt_device_get_active_profile_ret =
317       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY;
318   cras_bt_device_can_switch_to_a2dp_ret = 1;
319   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
320                                CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
321 
322   EXPECT_EQ(1, cras_bt_device_set_active_profile_called);
323   EXPECT_EQ(CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE,
324             cras_bt_device_set_active_profile_val);
325   cras_bt_io_destroy(bt_iodev);
326 }
327 
TEST_F(BtIoBasicSuite,CreateNoSetDeviceActiveProfileToA2DP)328 TEST_F(BtIoBasicSuite, CreateNoSetDeviceActiveProfileToA2DP) {
329   ResetStubData();
330   cras_bt_device_get_active_profile_ret =
331       CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY;
332   cras_bt_device_can_switch_to_a2dp_ret = 0;
333   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
334                                CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
335 
336   EXPECT_EQ(0, cras_bt_device_set_active_profile_called);
337   cras_bt_io_destroy(bt_iodev);
338 }
339 
TEST_F(BtIoBasicSuite,CreateSetDeviceActiveProfileToHFP)340 TEST_F(BtIoBasicSuite, CreateSetDeviceActiveProfileToHFP) {
341   ResetStubData();
342   cras_bt_device_get_active_profile_ret = 0;
343   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
344                                CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY);
345 
346   EXPECT_EQ(CRAS_BT_DEVICE_PROFILE_HFP_AUDIOGATEWAY |
347                 CRAS_BT_DEVICE_PROFILE_HSP_AUDIOGATEWAY,
348             cras_bt_device_set_active_profile_val);
349   cras_bt_io_destroy(bt_iodev);
350 }
351 
TEST_F(BtIoBasicSuite,CreateDeviceWithInvalidUTF8Name)352 TEST_F(BtIoBasicSuite, CreateDeviceWithInvalidUTF8Name) {
353   ResetStubData();
354   strcpy(iodev_.info.name, "Something BT");
355   iodev_.info.name[0] = 0xfe;
356   is_utf8_string_ret_value = 0;
357   bt_iodev = cras_bt_io_create(fake_device, &iodev_,
358                                CRAS_BT_DEVICE_PROFILE_A2DP_SOURCE);
359 
360   ASSERT_STREQ("BLUETOOTH", bt_iodev->active_node->name);
361   cras_bt_io_destroy(bt_iodev);
362 }
363 
364 }  // namespace
365 
main(int argc,char ** argv)366 int main(int argc, char** argv) {
367   ::testing::InitGoogleTest(&argc, argv);
368   return RUN_ALL_TESTS();
369 }
370 
371 extern "C" {
372 
373 // Cras iodev
cras_iodev_add_node(struct cras_iodev * iodev,struct cras_ionode * node)374 void cras_iodev_add_node(struct cras_iodev* iodev, struct cras_ionode* node) {
375   cras_iodev_add_node_called++;
376   DL_APPEND(iodev->nodes, node);
377 }
378 
cras_iodev_rm_node(struct cras_iodev * iodev,struct cras_ionode * node)379 void cras_iodev_rm_node(struct cras_iodev* iodev, struct cras_ionode* node) {
380   cras_iodev_rm_node_called++;
381   DL_DELETE(iodev->nodes, node);
382 }
383 
cras_iodev_free_format(struct cras_iodev * iodev)384 void cras_iodev_free_format(struct cras_iodev* iodev) {
385   cras_iodev_free_format_called++;
386 }
387 
cras_iodev_set_active_node(struct cras_iodev * iodev,struct cras_ionode * node)388 void cras_iodev_set_active_node(struct cras_iodev* iodev,
389                                 struct cras_ionode* node) {
390   cras_iodev_set_active_node_called++;
391   iodev->active_node = node;
392 }
393 
cras_iodev_set_node_attr(struct cras_ionode * ionode,enum ionode_attr attr,int value)394 int cras_iodev_set_node_attr(struct cras_ionode* ionode,
395                              enum ionode_attr attr,
396                              int value) {
397   return 0;
398 }
399 
cras_iodev_free_resources(struct cras_iodev * iodev)400 void cras_iodev_free_resources(struct cras_iodev* iodev) {
401   cras_iodev_free_resources_called++;
402 }
403 
404 //  From iodev list.
cras_iodev_list_add_output(struct cras_iodev * output)405 int cras_iodev_list_add_output(struct cras_iodev* output) {
406   cras_iodev_list_add_output_called++;
407   return 0;
408 }
409 
cras_iodev_list_rm_output(struct cras_iodev * dev)410 int cras_iodev_list_rm_output(struct cras_iodev* dev) {
411   cras_iodev_list_rm_output_called++;
412   return 0;
413 }
414 
cras_iodev_list_add_input(struct cras_iodev * output)415 int cras_iodev_list_add_input(struct cras_iodev* output) {
416   cras_iodev_list_add_input_called++;
417   return 0;
418 }
419 
cras_iodev_list_rm_input(struct cras_iodev * dev)420 int cras_iodev_list_rm_input(struct cras_iodev* dev) {
421   cras_iodev_list_rm_input_called++;
422   return 0;
423 }
424 
425 // From bt device
cras_bt_device_get_active_profile(const struct cras_bt_device * device)426 unsigned int cras_bt_device_get_active_profile(
427     const struct cras_bt_device* device) {
428   return cras_bt_device_get_active_profile_ret;
429 }
430 
cras_bt_device_set_active_profile(struct cras_bt_device * device,unsigned int profile)431 void cras_bt_device_set_active_profile(struct cras_bt_device* device,
432                                        unsigned int profile) {
433   cras_bt_device_set_active_profile_called++;
434   cras_bt_device_set_active_profile_val = profile;
435 }
436 
cras_bt_device_has_a2dp(struct cras_bt_device * device)437 int cras_bt_device_has_a2dp(struct cras_bt_device* device) {
438   return cras_bt_device_has_a2dp_ret;
439 }
440 
cras_bt_device_can_switch_to_a2dp(struct cras_bt_device * device)441 int cras_bt_device_can_switch_to_a2dp(struct cras_bt_device* device) {
442   return cras_bt_device_can_switch_to_a2dp_ret;
443 }
444 
cras_bt_device_switch_profile(struct cras_bt_device * device,struct cras_iodev * bt_iodev)445 int cras_bt_device_switch_profile(struct cras_bt_device* device,
446                                   struct cras_iodev* bt_iodev) {
447   cras_bt_device_switch_profile_called++;
448   return 0;
449 }
450 
cras_bt_device_switch_profile_enable_dev(struct cras_bt_device * device,struct cras_iodev * bt_iodev)451 int cras_bt_device_switch_profile_enable_dev(struct cras_bt_device* device,
452                                              struct cras_iodev* bt_iodev) {
453   cras_bt_device_switch_profile_enable_dev_called++;
454   return 0;
455 }
456 
cras_bt_device_object_path(const struct cras_bt_device * device)457 const char* cras_bt_device_object_path(const struct cras_bt_device* device) {
458   return "/fake/object/path";
459 }
460 
cras_bt_device_get_stable_id(const struct cras_bt_device * device)461 int cras_bt_device_get_stable_id(const struct cras_bt_device* device) {
462   return 123;
463 }
464 
cras_bt_device_get_use_hardware_volume(struct cras_bt_device * device)465 int cras_bt_device_get_use_hardware_volume(struct cras_bt_device* device) {
466   return 1;
467 }
468 
is_utf8_string(const char * string)469 int is_utf8_string(const char* string) {
470   return is_utf8_string_ret_value;
471 }
472 
cras_iodev_default_no_stream_playback(struct cras_iodev * odev,int enable)473 int cras_iodev_default_no_stream_playback(struct cras_iodev* odev, int enable) {
474   return 0;
475 }
476 
cras_iodev_frames_queued(struct cras_iodev * iodev,struct timespec * hw_tstamp)477 int cras_iodev_frames_queued(struct cras_iodev* iodev,
478                              struct timespec* hw_tstamp) {
479   return 0;
480 }
481 
cras_iodev_default_frames_to_play_in_sleep(struct cras_iodev * odev,unsigned int * hw_level,struct timespec * hw_tstamp)482 unsigned int cras_iodev_default_frames_to_play_in_sleep(
483     struct cras_iodev* odev,
484     unsigned int* hw_level,
485     struct timespec* hw_tstamp) {
486   return 0;
487 }
488 
hfp_iodev_is_hsp(struct cras_iodev * iodev)489 int hfp_iodev_is_hsp(struct cras_iodev* iodev) {
490   return 0;
491 }
492 
493 }  // extern "C"
494