aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordvdli <dvdli@google.com>2021-01-12 14:53:42 +0800
committerdvdli <dvdli@google.com>2021-01-12 15:55:49 +0800
commit855354a87d2983e190088bc5330c129094b900ca (patch)
tree40c092f7c992e9c6f83edcaf41e9cb0706698890 /tests
parent565fc0e3da9bf0ccea99eb4386a4890cdba56134 (diff)
remove pcm_prepare in pcm_open
For the dynamic pcm device, it is valid to specify the backend after opening it. However, it is invalid to call prepare on a dynamic pcm device without connecting any backend device. We should not do pcm_prepare in pcm_open. See also: Issue #197
Diffstat (limited to 'tests')
-rw-r--r--tests/src/pcm_in_test.cc1
-rw-r--r--tests/src/pcm_loopback_test.cc2
-rw-r--r--tests/src/pcm_out_test.cc2
3 files changed, 5 insertions, 0 deletions
diff --git a/tests/src/pcm_in_test.cc b/tests/src/pcm_in_test.cc
index e912abb..5491b00 100644
--- a/tests/src/pcm_in_test.cc
+++ b/tests/src/pcm_in_test.cc
@@ -47,6 +47,7 @@ class PcmInTest : public ::testing::Test {
pcm_object = pcm_open(kLoopbackCard, kLoopbackCaptureDevice, PCM_IN, &kDefaultConfig);
ASSERT_NE(pcm_object, nullptr);
ASSERT_TRUE(pcm_is_ready(pcm_object));
+ pcm_prepare(pcm_object);
}
virtual void TearDown() override {
diff --git a/tests/src/pcm_loopback_test.cc b/tests/src/pcm_loopback_test.cc
index 6a3ffb8..9685364 100644
--- a/tests/src/pcm_loopback_test.cc
+++ b/tests/src/pcm_loopback_test.cc
@@ -160,6 +160,7 @@ TEST(PcmLoopbackTest, LoopbackS16le) {
};
pcm *pcm_in = pcm_open(kLoopbackCard, kLoopbackCaptureDevice, PCM_IN, &kInConfig);
ASSERT_TRUE(pcm_is_ready(pcm_in));
+ pcm_prepare(pcm_in);
static constexpr pcm_config kOutConfig = {
.channels = kDefaultChannels,
@@ -174,6 +175,7 @@ TEST(PcmLoopbackTest, LoopbackS16le) {
};
pcm *pcm_out = pcm_open(kLoopbackCard, kLoopbackPlaybackDevice, PCM_OUT, &kOutConfig);
ASSERT_TRUE(pcm_is_ready(pcm_out));
+ pcm_prepare(pcm_out);
ASSERT_EQ(pcm_link(pcm_in, pcm_out), 0);
diff --git a/tests/src/pcm_out_test.cc b/tests/src/pcm_out_test.cc
index cbc6983..ca984a6 100644
--- a/tests/src/pcm_out_test.cc
+++ b/tests/src/pcm_out_test.cc
@@ -47,6 +47,7 @@ class PcmOutTest : public ::testing::Test {
pcm_object = pcm_open(kLoopbackCard, kLoopbackPlaybackDevice, PCM_OUT, &kDefaultConfig);
ASSERT_NE(pcm_object, nullptr);
ASSERT_TRUE(pcm_is_ready(pcm_object));
+ pcm_prepare(pcm_object);
}
virtual void TearDown() override {
@@ -176,6 +177,7 @@ class PcmOutMmapTest : public PcmOutTest {
&kDefaultConfig);
ASSERT_NE(pcm_object, nullptr);
ASSERT_TRUE(pcm_is_ready(pcm_object));
+ pcm_prepare(pcm_object);
}
virtual void TearDown() override {