mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
2c114db2f1
commit
c31a91230d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue