~ft/zuke

29431d5c36b1ddfb4050b753d816cf1a673e7dd5 — Sigrid Haflínudóttir 7 months ago 6d6c45d
don't get stuck forever on broken streams, skip to the next one
1 files changed, 5 insertions(+), 3 deletions(-)

M zuke.c
M zuke.c => zuke.c +5 -3
@@ 440,7 440,6 @@ playerthread(void *player_)
	player = player_;
	noinit = 0;
	bytesfrom = 0;
	c = 0;
	buf = nil;
	trycoverload = 1;
	io = nil;


@@ 479,6 478,7 @@ restart:
	close(p[0]);

	byteswritten = 0;
	c = 0;
	if(!noinit){
		sendul(player->ev, Evready);
		buf = malloc(Relbufsz);


@@ 486,11 486,12 @@ restart:
			sysfatal("player: %r");
		if((n = ioreadn(io, p[1], buf, Relbufsz)) < 0)
			fprint(2, "player: %r\n");
		if(n < 1 || recv(player->ctl, &c) < 0 || c != Cstart)
		if(recv(player->ctl, &c) < 0 || c != Cstart)
			goto freeplayer;
		if(n < 1)
			goto next;
		byteswritten = iowrite(io, audio, buf, n);
		bytesfrom = 0;
		c = 0;
		noinit = 1;
	}



@@ 558,6 559,7 @@ restart:
		close(p[1]);
		p[1] = -1;
		if(c != Cbackward && c != Cbackwardfast){
next:
			playercurr = nil;
			playercurr = newplayer((player->pcur+1) % plnum, 1);
			start(playercurr);