aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/cubeb.c2
-rw-r--r--test/test_device_changed_callback.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/cubeb.c b/src/cubeb.c
index bb35e0c..98a735f 100644
--- a/src/cubeb.c
+++ b/src/cubeb.c
@@ -303,7 +303,7 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n
{
int r;
- if (!context || !stream) {
+ if (!context || !stream || !data_callback || !state_callback) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
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);