mirror of https://github.com/ericonr/sndio.git
Split dev_close() routine in two parts.
The first part disconnects clients, the other closes the device and frees audio buffers. No behavior change.
This commit is contained in:
parent
803cf23380
commit
58f116481d
14
sndiod/dev.c
14
sndiod/dev.c
|
@ -61,6 +61,7 @@ void dev_adjpar(struct dev *, int, int, int);
|
||||||
int dev_open_do(struct dev *);
|
int dev_open_do(struct dev *);
|
||||||
int dev_open(struct dev *);
|
int dev_open(struct dev *);
|
||||||
void dev_exitall(struct dev *);
|
void dev_exitall(struct dev *);
|
||||||
|
void dev_close_do(struct dev *);
|
||||||
void dev_close(struct dev *);
|
void dev_close(struct dev *);
|
||||||
int dev_ref(struct dev *);
|
int dev_ref(struct dev *);
|
||||||
void dev_unref(struct dev *);
|
void dev_unref(struct dev *);
|
||||||
|
@ -1141,7 +1142,7 @@ dev_exitall(struct dev *d)
|
||||||
* ensure buffers are drained
|
* ensure buffers are drained
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dev_close(struct dev *d)
|
dev_close_do(struct dev *d)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (log_level >= 3) {
|
if (log_level >= 3) {
|
||||||
|
@ -1150,7 +1151,6 @@ dev_close(struct dev *d)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
d->pstate = DEV_CFG;
|
d->pstate = DEV_CFG;
|
||||||
dev_exitall(d);
|
|
||||||
dev_sio_close(d);
|
dev_sio_close(d);
|
||||||
if (d->mode & MODE_PLAY) {
|
if (d->mode & MODE_PLAY) {
|
||||||
if (d->encbuf != NULL)
|
if (d->encbuf != NULL)
|
||||||
|
@ -1164,6 +1164,16 @@ dev_close(struct dev *d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Close the device and exit all slots
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
dev_close(struct dev *d)
|
||||||
|
{
|
||||||
|
dev_exitall(d);
|
||||||
|
dev_close_do(d);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dev_ref(struct dev *d)
|
dev_ref(struct dev *d)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue