From fa7cda8c534e0c1e7ea19a565f74608ba196bddf Mon Sep 17 00:00:00 2001 From: Hunter Date: Thu, 15 Feb 2024 00:58:54 -0800 Subject: [PATCH 1/7] First test loop for backends implemented, mock_wrtier assert fails --- src/tests/roc_sndio/test_pump.cpp | 104 +++++++++++------------------- 1 file changed, 39 insertions(+), 65 deletions(-) diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index c1b3a7e1b..0119f71be 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -17,14 +17,15 @@ #include "roc_core/temp_file.h" #include "roc_sndio/config.h" #include "roc_sndio/pump.h" -#ifdef ROC_TARGET_SOX +#include "roc_sndio/backend_map.h" +//#ifdef ROC_TARGET_SOX #include "roc_sndio/sox_sink.h" #include "roc_sndio/sox_source.h" -#endif // ROC_TARGET_SOX -#ifdef ROC_TARGET_SNDFILE +//#endif // ROC_TARGET_SOX +//#ifdef ROC_TARGET_SNDFILE #include "roc_sndio/sndfile_sink.h" #include "roc_sndio/sndfile_source.h" -#endif // ROC_TARGET_SNDFILE +//#endif // ROC_TARGET_SNDFILE namespace roc { namespace sndio { @@ -55,79 +56,52 @@ TEST_GROUP(pump) { }; TEST(pump, write_read) { -#ifdef ROC_TARGET_SOX - { enum { NumSamples = BufSize * 10 }; - -test::MockSource mock_source; -mock_source.add(NumSamples); - -core::TempFile file("test.wav"); - -{ - SoxSink sox_sink(arena, config); - CHECK(sox_sink.open(NULL, file.path())); - - Pump pump(buffer_factory, mock_source, NULL, sox_sink, BufDuration, SampleSpecs, - Pump::ModeOneshot); - CHECK(pump.is_valid()); - CHECK(pump.run()); - - CHECK(mock_source.num_returned() >= NumSamples - BufSize); -} - -SoxSource sox_source(arena, config); -CHECK(sox_source.open(NULL, file.path())); - -test::MockSink mock_writer; +{ + enum { NumSamples = BufSize * 10 }; + for(size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++){ + test::MockSource mock_source; + mock_source.add(NumSamples); -Pump pump(buffer_factory, - sox_source, - NULL, - mock_writer, - BufDuration, - SampleSpecs, - Pump::ModePermanent); -CHECK(pump.is_valid()); -CHECK(pump.run()); + core::TempFile file("test.wav"); -mock_writer.check(0, mock_source.num_returned()); -} -#endif // ROC_TARGET_SOX + IBackend &backend = BackendMap::instance().nth_backend(n_backend); + + { + IDevice *backend_device = backend.open_device(DeviceType_Sink, DriverType_File, "wav", file.path(), config, arena); + if(backend_device == NULL){ + continue; + } + ISink *backend_sink = backend_device->to_sink(); + Pump pump(buffer_factory, mock_source, NULL, *backend_sink, BufDuration, SampleSpecs, + Pump::ModeOneshot); + CHECK(pump.is_valid()); + CHECK(pump.run()); -#ifdef ROC_TARGET_SNDFILE -{ - enum { NumSamples = BufSize * 10 }; + CHECK(mock_source.num_returned() >= NumSamples - BufSize); + } - test::MockSource mock_source; - mock_source.add(NumSamples); + IDevice *backend_device = backend.open_device(DeviceType_Source, DriverType_File, "wav", file.path(), config, arena); + if(backend_device == NULL){ + continue; + } - core::TempFile file("test.wav"); + ISource * backend_source = backend_device->to_source(); - { - SndfileSink sndfile_sink(arena, config); - CHECK(sndfile_sink.open(NULL, file.path())); + test::MockSink mock_writer; - Pump pump(buffer_factory, mock_source, NULL, sndfile_sink, BufDuration, - SampleSpecs, Pump::ModeOneshot); + Pump pump(buffer_factory, + *backend_source, + NULL, + mock_writer, + BufDuration, + SampleSpecs, + Pump::ModePermanent); CHECK(pump.is_valid()); CHECK(pump.run()); - CHECK(mock_source.num_returned() >= NumSamples - BufSize); + mock_writer.check(0, mock_source.num_returned()); } - - SoxSource sndfile_source(arena, config); - CHECK(sndfile_source.open(NULL, file.path())); - - test::MockSink mock_writer; - - Pump pump(buffer_factory, sndfile_source, NULL, mock_writer, BufDuration, SampleSpecs, - Pump::ModePermanent); - CHECK(pump.is_valid()); - CHECK(pump.run()); - - mock_writer.check(0, mock_source.num_returned()); } -#endif // ROC_TARGET_SNDFILE } // namespace roc TEST(pump, write_overwrite_read) { From ca2999fb8d71bd8269a166f1ec52ee1e5a65bbc3 Mon Sep 17 00:00:00 2001 From: Hunter Date: Sun, 18 Feb 2024 12:18:59 -0800 Subject: [PATCH 2/7] Write and read refactoring to be simplified --- .../target_sndfile/roc_sndio/sndfile_sink.cpp | 28 ++++++------------- .../roc_sndio/sndfile_source.cpp | 10 +++---- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp index d0fa1b274..8b506772d 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp @@ -267,26 +267,16 @@ bool SndfileSink::has_clock() const { void SndfileSink::write(audio::Frame& frame) { roc_panic_if(!valid_); - const audio::sample_t* frame_data = frame.raw_samples(); - size_t frame_size = frame.num_raw_samples(); - audio::sample_t buffer_data[BUFFER_SIZE]; - size_t buffer_pos = 0; - - while (frame_size > 0) { - for (; frame_size > 0; buffer_pos++) { - buffer_data[buffer_pos] = *frame_data; - frame_data++; - frame_size--; - } + + audio::sample_t* frame_data = frame.raw_samples(); + sf_count_t frame_left = (sf_count_t)frame.num_raw_samples(); - if (buffer_pos > 0) { - sf_count_t write_count = sf_write_float(file_, buffer_data, (sf_count_t)BUFFER_SIZE); - if ( (write_count == 0 && frame_size > 0) || sf_error(file_) != 0) { - // TODO(gh-183): return error instead of panic - roc_panic("sndfile sink: sf_write_float(): %s,", sf_strerror(file_)); - } - } - buffer_pos = 0; + // Write entire float buffer in one call + sf_count_t count = sf_write_float(file_, frame_data, frame_left); + + if (count != frame_left || sf_error(file_) != 0) { + // TODO(gh-183): return error instead of panic + roc_panic("sndfile source: sf_write_float() failed: %s", sf_strerror(file_)); } } diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.cpp b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.cpp index 121b894f5..11076946a 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.cpp +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.cpp @@ -183,11 +183,11 @@ bool SndfileSource::read(audio::Frame& frame) { if (!file_) { roc_panic("sndfile source: read: non-open input file"); } - + audio::sample_t * frame_data = frame.raw_samples(); size_t num_channels = (size_t)file_info_.channels; sf_count_t frame_left = (sf_count_t)frame.num_raw_samples(); - sf_count_t samples_per_ch = (sf_count_t)(frame.num_raw_samples() / num_channels); + size_t samples_per_ch = frame.num_raw_samples() / num_channels; sf_count_t n_samples = sf_read_float(file_, frame_data, frame_left); if(sf_error(file_) != 0){ @@ -199,9 +199,9 @@ bool SndfileSource::read(audio::Frame& frame) { eof_ = true; } - if (n_samples < samples_per_ch) { - memset(frame.raw_samples() + (unsigned long)n_samples * num_channels, 0, - (unsigned long)(samples_per_ch - n_samples) * num_channels * sizeof(audio::sample_t)); + if ((size_t)n_samples < samples_per_ch) { + memset(frame.raw_samples() + (size_t)n_samples * num_channels, 0, + (samples_per_ch - (size_t)n_samples) * num_channels * sizeof(audio::sample_t)); } return !eof_; From b1718e5280c90ca57a6bf4efb4accef5cf5eacd8 Mon Sep 17 00:00:00 2001 From: Hunter Date: Sun, 18 Feb 2024 13:48:26 -0800 Subject: [PATCH 3/7] Seems like sndfile is causing the issue, fix for loop --- src/internal_modules/roc_sndio/ibackend.h | 2 ++ .../roc_sndio/pulseaudio_backend.cpp | 4 +++ .../roc_sndio/pulseaudio_backend.h | 2 ++ .../roc_sndio/sndfile_backend.cpp | 4 +++ .../roc_sndio/sndfile_backend.h | 4 +++ .../target_sox/roc_sndio/sox_backend.cpp | 4 +++ .../target_sox/roc_sndio/sox_backend.h | 2 ++ .../roc_sndio/wav_backend.cpp | 4 +++ src/internal_modules/roc_sndio/wav_backend.h | 2 ++ src/tests/roc_sndio/test_pump.cpp | 34 +++++++++++-------- 10 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/internal_modules/roc_sndio/ibackend.h b/src/internal_modules/roc_sndio/ibackend.h index 71a273f29..15a5b3734 100644 --- a/src/internal_modules/roc_sndio/ibackend.h +++ b/src/internal_modules/roc_sndio/ibackend.h @@ -40,6 +40,8 @@ class IBackend { const char* path, const Config& config, core::IArena& arena) = 0; + + virtual const char* name() const = 0; }; } // namespace sndio diff --git a/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.cpp b/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.cpp index b5474fbb7..b94f0d37e 100644 --- a/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.cpp +++ b/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.cpp @@ -59,5 +59,9 @@ IDevice* PulseaudioBackend::open_device(DeviceType device_type, return device.release(); } +const char* PulseaudioBackend::name() const{ + return "PulseAudio"; +} + } // namespace sndio } // namespace roc diff --git a/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.h b/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.h index 1bb9785cb..ed206da02 100644 --- a/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.h +++ b/src/internal_modules/roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_backend.h @@ -33,6 +33,8 @@ class PulseaudioBackend : public IBackend, core::NonCopyable<> { const char* path, const Config& config, core::IArena& arena); + + virtual const char* name() const; }; } // namespace sndio diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp index fe5ed29b9..ee50edb50 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp @@ -110,5 +110,9 @@ IDevice* SndfileBackend::open_device(DeviceType device_type, roc_panic("sndfile backend: invalid device type"); } + +const char* SndfileBackend::name() const { + return "sndfile"; +} } // namespace sndio } // namespace roc diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h index 5d64c008c..de07743e6 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h @@ -36,8 +36,12 @@ class SndfileBackend : public IBackend, core::NonCopyable<> { const char* path, const Config& config, core::IArena& arena); + + virtual const char* name() const; }; + + } // namespace sndio } // namespace roc diff --git a/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.cpp b/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.cpp index 11ff72cfa..71ace49a6 100644 --- a/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.cpp +++ b/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.cpp @@ -294,5 +294,9 @@ IDevice* SoxBackend::open_device(DeviceType device_type, roc_panic("sox backend: invalid device type"); } +const char* SoxBackend::name() const{ + return "SoX"; +} + } // namespace sndio } // namespace roc diff --git a/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.h b/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.h index a0a863b37..2814c9830 100644 --- a/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.h +++ b/src/internal_modules/roc_sndio/target_sox/roc_sndio/sox_backend.h @@ -43,6 +43,8 @@ class SoxBackend : public IBackend, core::NonCopyable<> { const Config& config, core::IArena& arena); + virtual const char* name() const; + private: bool first_created_; }; diff --git a/src/internal_modules/roc_sndio/wav_backend.cpp b/src/internal_modules/roc_sndio/wav_backend.cpp index 4909da682..d5e486cd5 100644 --- a/src/internal_modules/roc_sndio/wav_backend.cpp +++ b/src/internal_modules/roc_sndio/wav_backend.cpp @@ -76,5 +76,9 @@ IDevice* WavBackend::open_device(DeviceType device_type, roc_panic("wav backend: invalid device type"); } +const char* WavBackend::name() const { + return "wav"; +} + } // namespace sndio } // namespace roc diff --git a/src/internal_modules/roc_sndio/wav_backend.h b/src/internal_modules/roc_sndio/wav_backend.h index 42d5d89cb..ac1eac4e8 100644 --- a/src/internal_modules/roc_sndio/wav_backend.h +++ b/src/internal_modules/roc_sndio/wav_backend.h @@ -34,6 +34,8 @@ class WavBackend : public IBackend, core::NonCopyable<> { const char* path, const Config& config, core::IArena& arena); + + virtual const char* name() const; }; } // namespace sndio diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 0119f71be..400c9e18b 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -18,14 +18,14 @@ #include "roc_sndio/config.h" #include "roc_sndio/pump.h" #include "roc_sndio/backend_map.h" -//#ifdef ROC_TARGET_SOX +#ifdef ROC_TARGET_SOX #include "roc_sndio/sox_sink.h" #include "roc_sndio/sox_source.h" -//#endif // ROC_TARGET_SOX -//#ifdef ROC_TARGET_SNDFILE +#endif // ROC_TARGET_SOX +#ifdef ROC_TARGET_SNDFILE #include "roc_sndio/sndfile_sink.h" #include "roc_sndio/sndfile_source.h" -//#endif // ROC_TARGET_SNDFILE +#endif // ROC_TARGET_SNDFILE namespace roc { namespace sndio { @@ -65,26 +65,32 @@ TEST(pump, write_read) { core::TempFile file("test.wav"); IBackend &backend = BackendMap::instance().nth_backend(n_backend); + printf("Currently on: %s\n", backend.name()); { IDevice *backend_device = backend.open_device(DeviceType_Sink, DriverType_File, "wav", file.path(), config, arena); if(backend_device == NULL){ - continue; + printf("Failing sink test: %s\n", backend.name()); + } + else{ + printf("Passing sink test: %s\n", backend.name()); + ISink *backend_sink = backend_device->to_sink(); + Pump pump(buffer_factory, mock_source, NULL, *backend_sink, BufDuration, SampleSpecs, + Pump::ModeOneshot); + CHECK(pump.is_valid()); + CHECK(pump.run()); + + CHECK(mock_source.num_returned() >= NumSamples - BufSize); } - ISink *backend_sink = backend_device->to_sink(); - Pump pump(buffer_factory, mock_source, NULL, *backend_sink, BufDuration, SampleSpecs, - Pump::ModeOneshot); - CHECK(pump.is_valid()); - CHECK(pump.run()); - - CHECK(mock_source.num_returned() >= NumSamples - BufSize); } - + IDevice *backend_device = backend.open_device(DeviceType_Source, DriverType_File, "wav", file.path(), config, arena); if(backend_device == NULL){ + printf("Failing source test: %s\n", backend.name()); continue; - } + } + printf("Passing source test: %s\n\n", backend.name()); ISource * backend_source = backend_device->to_source(); test::MockSink mock_writer; From 406896e5dbb8a0581f05698b9f18b65bb1b068fc Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 19 Feb 2024 12:47:22 -0800 Subject: [PATCH 4/7] Scoped ptr somehow --- src/internal_modules/roc_sndio/wav_backend.cpp | 1 + src/internal_modules/roc_sndio/wav_source.cpp | 1 + src/tests/roc_sndio/test_pump.cpp | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/internal_modules/roc_sndio/wav_backend.cpp b/src/internal_modules/roc_sndio/wav_backend.cpp index d5e486cd5..4a5640f63 100644 --- a/src/internal_modules/roc_sndio/wav_backend.cpp +++ b/src/internal_modules/roc_sndio/wav_backend.cpp @@ -13,6 +13,7 @@ #include "roc_sndio/wav_sink.h" #include "roc_sndio/wav_source.h" + namespace roc { namespace sndio { diff --git a/src/internal_modules/roc_sndio/wav_source.cpp b/src/internal_modules/roc_sndio/wav_source.cpp index 4dd260c61..f5e1a746f 100644 --- a/src/internal_modules/roc_sndio/wav_source.cpp +++ b/src/internal_modules/roc_sndio/wav_source.cpp @@ -159,6 +159,7 @@ bool WavSource::read(audio::Frame& frame) { } bool WavSource::open_(const char* path) { + if (file_opened_) { roc_panic("wav source: already opened"); } diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 400c9e18b..7194dabcf 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -13,6 +13,7 @@ #include "roc_core/buffer_factory.h" #include "roc_core/heap_arena.h" +#include "roc_core/scoped_ptr.h" #include "roc_core/stddefs.h" #include "roc_core/temp_file.h" #include "roc_sndio/config.h" @@ -57,6 +58,7 @@ TEST_GROUP(pump) { TEST(pump, write_read) { { + enum { NumSamples = BufSize * 10 }; for(size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++){ test::MockSource mock_source; @@ -64,16 +66,19 @@ TEST(pump, write_read) { core::TempFile file("test.wav"); - IBackend &backend = BackendMap::instance().nth_backend(n_backend); + core::ScopedPtr backend(BackendMap::instance().nth_backend(n_backend), arena); printf("Currently on: %s\n", backend.name()); + fflush(stdout); { IDevice *backend_device = backend.open_device(DeviceType_Sink, DriverType_File, "wav", file.path(), config, arena); if(backend_device == NULL){ printf("Failing sink test: %s\n", backend.name()); + fflush(stdout); } else{ printf("Passing sink test: %s\n", backend.name()); + fflush(stdout); ISink *backend_sink = backend_device->to_sink(); Pump pump(buffer_factory, mock_source, NULL, *backend_sink, BufDuration, SampleSpecs, Pump::ModeOneshot); @@ -83,14 +88,18 @@ TEST(pump, write_read) { CHECK(mock_source.num_returned() >= NumSamples - BufSize); } } + printf("File path: %s\n", file.path()); + fflush(stdout); IDevice *backend_device = backend.open_device(DeviceType_Source, DriverType_File, "wav", file.path(), config, arena); if(backend_device == NULL){ printf("Failing source test: %s\n", backend.name()); + fflush(stdout); continue; } printf("Passing source test: %s\n\n", backend.name()); + fflush(stdout); ISource * backend_source = backend_device->to_source(); test::MockSink mock_writer; From a7ce6def53f7450ee48578e00689cb2bd5c27e15 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 19 Feb 2024 14:05:08 -0800 Subject: [PATCH 5/7] back to no ptr --- src/tests/roc_sndio/test_pump.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 7194dabcf..53f31df0f 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -13,7 +13,6 @@ #include "roc_core/buffer_factory.h" #include "roc_core/heap_arena.h" -#include "roc_core/scoped_ptr.h" #include "roc_core/stddefs.h" #include "roc_core/temp_file.h" #include "roc_sndio/config.h" @@ -66,7 +65,7 @@ TEST(pump, write_read) { core::TempFile file("test.wav"); - core::ScopedPtr backend(BackendMap::instance().nth_backend(n_backend), arena); + IBackend &backend = BackendMap::instance().nth_backend(n_backend); printf("Currently on: %s\n", backend.name()); fflush(stdout); @@ -99,7 +98,7 @@ TEST(pump, write_read) { } printf("Passing source test: %s\n\n", backend.name()); - fflush(stdout); + ISource * backend_source = backend_device->to_source(); test::MockSink mock_writer; From de4fb8ce6875e8e0f1a6018261b0bb6e7ff09436 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 19 Feb 2024 14:18:32 -0800 Subject: [PATCH 6/7] back to step 1 --- src/tests/roc_sndio/test_pump.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index 53f31df0f..f86c36a57 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -59,11 +59,12 @@ TEST(pump, write_read) { { enum { NumSamples = BufSize * 10 }; + for(size_t n_backend = 0; n_backend < BackendMap::instance().num_backends(); n_backend++){ test::MockSource mock_source; mock_source.add(NumSamples); - core::TempFile file("test.wav"); + IBackend &backend = BackendMap::instance().nth_backend(n_backend); printf("Currently on: %s\n", backend.name()); From b0e85361fcb6ad7b01b273c05a9f32e0b2f3b52b Mon Sep 17 00:00:00 2001 From: Hunter Date: Tue, 20 Feb 2024 02:19:11 -0800 Subject: [PATCH 7/7] scopedptr solution makes all tests pass again --- src/tests/roc_sndio/test_pump.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index f86c36a57..190aa6248 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -13,6 +13,7 @@ #include "roc_core/buffer_factory.h" #include "roc_core/heap_arena.h" +#include "roc_core/scoped_ptr.h" #include "roc_core/stddefs.h" #include "roc_core/temp_file.h" #include "roc_sndio/config.h" @@ -79,7 +80,7 @@ TEST(pump, write_read) { else{ printf("Passing sink test: %s\n", backend.name()); fflush(stdout); - ISink *backend_sink = backend_device->to_sink(); + core::ScopedPtr backend_sink(backend_device->to_sink(), arena); Pump pump(buffer_factory, mock_source, NULL, *backend_sink, BufDuration, SampleSpecs, Pump::ModeOneshot); CHECK(pump.is_valid()); @@ -100,7 +101,7 @@ TEST(pump, write_read) { printf("Passing source test: %s\n\n", backend.name()); - ISource * backend_source = backend_device->to_source(); + core::ScopedPtr backend_source(backend_device->to_source(), arena); test::MockSink mock_writer;