diff options
author | Chun-Min Chang <[email protected]> | 2019-03-29 14:17:03 -0700 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2019-03-30 10:17:03 +1300 |
commit | f8a6768684352fe6fd32920b7eadfe9c694f7128 (patch) | |
tree | 9e75a6be5e08b3e73f85177673d43bdd1d248713 /test | |
parent | 681d4b7ee6d098f35ea853eb12825ed40cb64156 (diff) | |
download | cubeb-f8a6768684352fe6fd32920b7eadfe9c694f7128.tar.gz cubeb-f8a6768684352fe6fd32920b7eadfe9c694f7128.zip |
Make sure data_callback and state_callback are not null (#496)
* Make sure data_callback and state_callback are not null
* Check callbacks are valid in cubeb.c
* Initialize stream with non-null callbacks
Diffstat (limited to 'test')
-rw-r--r-- | test/test_device_changed_callback.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_device_changed_callback.cpp b/test/test_device_changed_callback.cpp index 89d9f29..607a4c9 100644 --- a/test/test_device_changed_callback.cpp +++ b/test/test_device_changed_callback.cpp @@ -26,6 +26,15 @@ #define OUTPUT_CHANNELS 2 #define OUTPUT_LAYOUT CUBEB_LAYOUT_STEREO +long data_callback(cubeb_stream * stream, void * user, const void * inputbuffer, void * outputbuffer, long nframes) +{ + return 0; +} + +void state_callback(cubeb_stream * stream, void * user, cubeb_state state) +{ +} + void device_changed_callback(void * user) { fprintf(stderr, "device changed callback\n"); @@ -105,7 +114,7 @@ TEST(cubeb, device_changed_callbacks) r = cubeb_stream_init(ctx, &stream, "Cubeb duplex", NULL, &input_params, NULL, &output_params, - latency_frames, nullptr, nullptr, nullptr); + latency_frames, data_callback, state_callback, nullptr); ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream"; test_registering_null_callback_twice(stream); |