]> git.alsa-project.org Git - tinycompress.git/commitdiff
fcplay: Correct metadata.next_track sequence for gapless playback
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 11 Mar 2026 06:57:34 +0000 (08:57 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 29 May 2026 11:23:04 +0000 (13:23 +0200)
The kernel demands the metadata to be set before the next_track is
signaled (since 2013).
Calling next_track before set metadata will case the next_track to be
'lost' in core's snd_compr_next_track().

Reverse the call order of next_track and set_metadata to fix this.

Fixes: 40603c037c8d ("fcplay: Modify play_samples func to support gapless playback.")
Closes: https://github.com/alsa-project/tinycompress/pull/33
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/utils-lgpl/fcplay.c

index 1b89c2bec62672593fceb959c2e8806524903721..8069fe8b76295c18e27a7bb1993aed6b5fff14d7 100644 (file)
@@ -422,14 +422,14 @@ void play_samples(char **files, unsigned int card, unsigned int device,
                        if (gapless) {
                                parse_file(name, &codec);
 
-                               rc = compress_next_track(compress);
-                               if (rc)
-                                       fprintf(stderr, "ERR: compress next track set\n");
-
                                rc = compress_set_gapless_metadata(compress, &mdata);
                                if (rc)
                                        fprintf(stderr, "ERR: set gapless metadata\n");
 
+                               rc = compress_next_track(compress);
+                               if (rc)
+                                       fprintf(stderr, "ERR: compress next track set\n");
+
                                rc = compress_set_codec_params(compress, &codec);
                                if (rc)
                                        fprintf(stderr, "ERR: set next track codec params\n");