input/wav: Send END packet on cleanup.
This commit is contained in:
parent
c10ef17c23
commit
0a4d68f74b
|
@ -238,17 +238,9 @@ static void send_chunk(const struct sr_input *in, int offset, int num_samples)
|
||||||
|
|
||||||
static int receive(const struct sr_input *in, GString *buf)
|
static int receive(const struct sr_input *in, GString *buf)
|
||||||
{
|
{
|
||||||
struct sr_datafeed_packet packet;
|
|
||||||
struct context *inc;
|
struct context *inc;
|
||||||
int offset, chunk_samples, total_samples, processed, max_chunk_samples, num_samples, i;
|
int offset, chunk_samples, total_samples, processed, max_chunk_samples, num_samples, i;
|
||||||
|
|
||||||
if (buf->len == 0) {
|
|
||||||
/* End of stream. */
|
|
||||||
packet.type = SR_DF_END;
|
|
||||||
sr_session_send(in->sdi, &packet);
|
|
||||||
return SR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_string_append_len(in->buf, buf->str, buf->len);
|
g_string_append_len(in->buf, buf->str, buf->len);
|
||||||
|
|
||||||
if (!in->priv) {
|
if (!in->priv) {
|
||||||
|
@ -308,8 +300,16 @@ static int receive(const struct sr_input *in, GString *buf)
|
||||||
|
|
||||||
static int cleanup(struct sr_input *in)
|
static int cleanup(struct sr_input *in)
|
||||||
{
|
{
|
||||||
g_free(in->priv);
|
struct sr_datafeed_packet packet;
|
||||||
in->priv = NULL;
|
|
||||||
|
if (in->priv) {
|
||||||
|
/* End of stream. */
|
||||||
|
packet.type = SR_DF_END;
|
||||||
|
sr_session_send(in->sdi, &packet);
|
||||||
|
|
||||||
|
g_free(in->priv);
|
||||||
|
in->priv = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue