From: cinap_lenrek Date: Sun, 27 Jan 2013 13:00:42 +0000 (+0100) Subject: audioac97, audiohda: dont block on close, just pad the last block with zeros X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;ds=sidebyside;h=866ee3ab5d0818194cca8c04d1f3ec2ff1d148c9;p=plan9front.git audioac97, audiohda: dont block on close, just pad the last block with zeros --- diff --git a/sys/src/9/pc/audioac97.c b/sys/src/9/pc/audioac97.c index 3149458ad..477324870 100644 --- a/sys/src/9/pc/audioac97.c +++ b/sys/src/9/pc/audioac97.c @@ -390,16 +390,15 @@ ac97close(Audio *adev, int mode) { Ctlr *ctlr; Ring *ring; - uchar z[1]; if(mode == OREAD) return; - z[0] = 0; ctlr = adev->ctlr; ring = &ctlr->outring; while(ring->wi % Blocksize) - ac97write(adev, z, sizeof(z), 0); + if(writering(ring, (uchar*)"", 1) <= 0) + break; } static Pcidev* diff --git a/sys/src/9/pc/audiohda.c b/sys/src/9/pc/audiohda.c index b29cb04e8..d7e862eb9 100644 --- a/sys/src/9/pc/audiohda.c +++ b/sys/src/9/pc/audiohda.c @@ -1296,7 +1296,7 @@ static void hdaclose(Audio *adev, int mode) { Ctlr *ctlr; - uchar z[1]; + Ring *ring; ctlr = adev->ctlr; if(mode == OREAD || mode == ORDWR){ @@ -1304,11 +1304,10 @@ hdaclose(Audio *adev, int mode) streamstop(ctlr, &ctlr->sin); } if(mode == OWRITE || mode == ORDWR){ - if(ctlr->sout.active){ - z[0] = 0; - while(ctlr->sout.ring.wi % Blocksize) - hdawrite(adev, z, sizeof(z), 0); - } + ring = &ctlr->sout.ring; + while(ring->wi % Blocksize) + if(writering(ring, (uchar*)"", 1) <= 0) + break; } }