Skip to content

Commit 08c6f50

Browse files
committed
Added the checks for a match of actual and requested sample-rates in the OSS driver.
Fail in case of a sample rate mimatch. Error message recommends using --enable-oss-cookedmode in case of a mismatch.
1 parent cb654ad commit 08c6f50

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/oss/oss_driver.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,13 @@ static int oss_driver_start (oss_driver_t *driver)
569569
"OSS: failed to set samplerate for %s: %s@%i, errno=%d",
570570
indev, __FILE__, __LINE__, errno);
571571
}
572+
if (samplerate != driver->sample_rate) {
573+
jack_error (
574+
"OSS: failed to set the recording sample-rate for %s: %s@%i, requested-sample-rate=%d, obtained-sample-rate=%d",
575+
indev, __FILE__, __LINE__, driver->sample_rate, samplerate);
576+
jack_error ("OSS: please consider configuring with --enable-oss-cookedmode");
577+
return -1;
578+
}
572579
jack_info ("oss_driver: %s : 0x%x/%i/%i (%i)", indev,
573580
format, channels, samplerate, get_fragment (infd));
574581

@@ -608,6 +615,13 @@ static int oss_driver_start (oss_driver_t *driver)
608615
"OSS: failed to set samplerate for %s: %s@%i, errno=%d",
609616
outdev, __FILE__, __LINE__, errno);
610617
}
618+
if (samplerate != driver->sample_rate) {
619+
jack_error (
620+
"OSS: failed to set the playback sample-rate for %s: %s@%i, requested-sample-rate=%d, obtained-sample-rate=%d",
621+
indev, __FILE__, __LINE__, driver->sample_rate, samplerate);
622+
jack_error ("OSS: please consider configuring with --enable-oss-cookedmode");
623+
return -1;
624+
}
611625
jack_info ("oss_driver: %s : 0x%x/%i/%i (%i)", outdev,
612626
format, channels, samplerate,
613627
get_fragment (outfd));

0 commit comments

Comments
 (0)