shithub: riscv

Download patch

ref: 9e818a5018384bc8faeda87ed1998678ea83fb46
parent: e5661f9d9974c84bd3637be74c1247ce8aec638d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Oct 26 18:21:15 EDT 2022

audio/flacdec: don't run pcmconv on s16r44100c2

--- a/sys/src/cmd/audio/flacdec/flacdec.c
+++ b/sys/src/cmd/audio/flacdec/flacdec.c
@@ -7,13 +7,14 @@
 #include <lib9.h>
 #include "FLAC/stream_decoder.h"
 
-static int ifd = -1;
+static int ifd = 1;
+static int pid = -1;
 static int sts;
 
 static void
 flushout(void)
 {
-	if(ifd >= 0){
+	if(pid >= 0){
 		close(ifd);
 		wait(&sts);
 	}
@@ -73,7 +74,7 @@
 static FLAC__StreamDecoderWriteStatus
 decoutput(FLAC__StreamDecoder *dec, FLAC__Frame *frame, FLAC__int32 *buffer[], void *client_data)
 {
-	static int rate, chans, bits;
+	static int rate = 44100, chans = 2, bits = 16;
 	static unsigned char *buf;
 	static int nbuf;
 	FLAC__int32 *s, v;
@@ -84,7 +85,7 @@
 	if(rate != frame->header.sample_rate
 	|| chans != frame->header.channels
 	|| bits != frame->header.bits_per_sample){
-		int pid, pfd[2];
+		int pfd[2];
 		char fmt[32];
 
 		rate = frame->header.sample_rate;