diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-09-08 00:05:02 +0300 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-12-31 12:20:59 +0100 |
commit | 01f5c5bebf4b1a8415a9837a42b018b3c1932d0b (patch) | |
tree | 1ba6d1f2652c052bd9ca7794b1c2b1786da9fef5 | |
parent | a183ced71eb78c27123d29ea3e9bbc646bcd4fdc (diff) |
osmo-gapk: wait until sink finish processing
Previously the osmo-gapk application used to exit as soon as all
the frames are processed, no matter has the sink finished its
internal processing (e.g. ALSA playback).
-rw-r--r-- | src/app_osmo_gapk.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app_osmo_gapk.c b/src/app_osmo_gapk.c index d02ccbe..16a614d 100644 --- a/src/app_osmo_gapk.c +++ b/src/app_osmo_gapk.c @@ -616,6 +616,7 @@ make_processing_chain(struct gapk_state *gs) static int run(struct gapk_state *gs) { + struct osmo_gapk_pq_item *item; int rv, frames; rv = osmo_gapk_pq_prepare(gs->pq); @@ -630,6 +631,14 @@ run(struct gapk_state *gs) LOGP(DAPP, LOGL_NOTICE, "Processed %d frames\n", frames); + /* Wait for sink to process buffers */ + item = llist_last_entry(&gs->pq->items, struct osmo_gapk_pq_item, list); + if (item->wait && !gs->exit) { + LOGP(DAPP, LOGL_NOTICE, "Waiting for sink to finish...\n"); + while (item->wait(item->state)) + continue; + } + return frames > 0 ? 0 : rv; } |