shout: don't write empty buffers
Add a check to write_page() which checks if there is actually data. Don't bother to call shout_send() if there is not.
This commit is contained in:
@@ -294,6 +294,9 @@ static int write_page(struct shout_data *sd)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (sd->buf.len == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
shout_sync(sd->shout_conn);
|
shout_sync(sd->shout_conn);
|
||||||
err = shout_send(sd->shout_conn, sd->buf.data, sd->buf.len);
|
err = shout_send(sd->shout_conn, sd->buf.data, sd->buf.len);
|
||||||
if (handle_shout_error(sd, err) < 0)
|
if (handle_shout_error(sd, err) < 0)
|
||||||
@@ -426,8 +429,7 @@ static int open_shout_conn(struct audio_output *audio_output)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd->buf.len)
|
write_page(sd);
|
||||||
write_page(sd);
|
|
||||||
|
|
||||||
sd->shout_error = 0;
|
sd->shout_error = 0;
|
||||||
sd->opened = 1;
|
sd->opened = 1;
|
||||||
|
Reference in New Issue
Block a user