]> git.alsa-project.org Git - alsa-lib.git/commitdiff
rawmidi: allow timestamp reads only for the appropriate read mode
authorJaroslav Kysela <perex@perex.cz>
Wed, 22 Sep 2021 11:16:54 +0000 (13:16 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 28 Oct 2021 06:40:20 +0000 (08:40 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/rawmidi/rawmidi.c

index 9fab63f1e2285b1e288c8bb3b80edde8aead41b3..58557e577edab4877cff534c884eeb9788fefdc7 100644 (file)
@@ -1112,5 +1112,7 @@ ssize_t snd_rawmidi_tread(snd_rawmidi_t *rawmidi, struct timespec *tstamp, void
        assert(rawmidi);
        assert(rawmidi->stream == SND_RAWMIDI_STREAM_INPUT);
        assert(buffer || size == 0);
+       if ((rawmidi->params_mode & SNDRV_RAWMIDI_MODE_FRAMING_MASK) == SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP)
+               return -EINVAL;
        return (rawmidi->ops->tread)(rawmidi, tstamp, buffer, size);
 }