summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-24 12:41:07 +0200
committerwm4 <wm4@nowhere>2014-08-24 13:21:32 +0200
commitc31a91230d48f4ed35ebd812d83a661f06f401e1 (patch)
tree67a067fdcfccd9c71ec8de2304a6dd134ea22e65
parent2c114db2f15a19a77ba00a9d7c785359fcb9bfd3 (diff)
downloadmpv-c31a91230d48f4ed35ebd812d83a661f06f401e1.tar.bz2
mpv-c31a91230d48f4ed35ebd812d83a661f06f401e1.tar.xz
demux: avoid unnecessary wakeups
If a packet is appended to a stream, and there were already packets queued, nothing about the state changed, as far as the user (i.e. the player) is concerned. Thus no wakeup is needed. The pthread_cond_signal() call following this is not interesting - it will simply be a NOP if there are actually no waiters.
-rw-r--r--demux/demux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c
index bb9363815e..f27b8d1855 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -318,7 +318,7 @@ int demux_add_packet(struct sh_stream *stream, demux_packet_t *dp)
"[num=%zd size=%zd]\n", stream_type_name(stream->type),
dp->len, dp->pts, dp->dts, dp->pos, ds->packs, ds->bytes);
- if (ds->in->wakeup_cb)
+ if (ds->in->wakeup_cb && !ds->head->next)
ds->in->wakeup_cb(ds->in->wakeup_cb_ctx);
pthread_cond_signal(&in->wakeup);
pthread_mutex_unlock(&in->lock);