mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
selftests/alsa: Check the aloop PCM Slave controls for a matching playback
Add a test that starts a playback with the same parameters as a running capture, and checks that the capture keeps running and that the "PCM Slave" controls report the playback's parameters, with a value event for each control that changed. Before the previous patch, the controls keep the parameters of the earlier stream and the test fails. Signed-off-by: Henrik Enquist <henrik.enquist@gmail.com> Link: https://patch.msgid.link/20261021-aloop-slave-controls-v1-2-62297727177f@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c3bde2beac
commit
d0bee96f84
|
|
@ -323,6 +323,46 @@ TEST_F(aloop, params_change_stops_capture_with_notify) {
|
|||
snd_pcm_close(capt);
|
||||
}
|
||||
|
||||
/*
|
||||
* A playback that joins a running capture with the same parameters doesn't
|
||||
* stop it, and the "PCM Slave" controls still report the playback's
|
||||
* parameters rather than those of an earlier stream.
|
||||
*/
|
||||
TEST_F(aloop, matching_playback_updates_controls) {
|
||||
snd_pcm_t *capt, *play;
|
||||
unsigned int events;
|
||||
|
||||
/* Leave the controls at other parameters than the ones used below. */
|
||||
ASSERT_EQ(open_pcm(&play, self->play_name, SND_PCM_STREAM_PLAYBACK, &playback_params), 0);
|
||||
ASSERT_EQ(start_playback(play, &playback_params), 0);
|
||||
snd_pcm_close(play);
|
||||
|
||||
ASSERT_EQ(set_notify(self->ctl, false), 0);
|
||||
ASSERT_EQ(open_pcm(&capt, self->capt_name, SND_PCM_STREAM_CAPTURE, &capture_params), 0);
|
||||
ASSERT_EQ(snd_pcm_start(capt), 0);
|
||||
read_events(self->ctl);
|
||||
|
||||
ASSERT_EQ(open_pcm(&play, self->play_name, SND_PCM_STREAM_PLAYBACK, &capture_params), 0);
|
||||
ASSERT_EQ(start_playback(play, &capture_params), 0);
|
||||
|
||||
EXPECT_EQ(snd_pcm_state(capt), SND_PCM_STATE_RUNNING);
|
||||
|
||||
EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Active"), 1);
|
||||
EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Format"), capture_params.format);
|
||||
EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Rate"), capture_params.rate);
|
||||
EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Channels"), capture_params.channels);
|
||||
EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Access Mode"), 0);
|
||||
|
||||
events = read_events(self->ctl);
|
||||
EXPECT_TRUE(events & EV_FORMAT);
|
||||
EXPECT_TRUE(events & EV_RATE);
|
||||
EXPECT_TRUE(events & EV_CHANNELS);
|
||||
EXPECT_TRUE(events & EV_ACCESS);
|
||||
|
||||
snd_pcm_close(play);
|
||||
snd_pcm_close(capt);
|
||||
}
|
||||
|
||||
/* With notify, a capture opened second is still pinned to the playback's parameters. */
|
||||
TEST_F(aloop, capture_constrained_with_notify) {
|
||||
struct probe_result res;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user