mirror of
https://github.com/mpv-player/mpv
synced 2025-04-19 05:37:26 +00:00
demux_timeline: skip decoder reinit when seeking to same segment
"Normal" seeks, which don't actually switch the segment, do not need to reinit the decoders.
This commit is contained in:
parent
0d19316de2
commit
fd57503890
@ -93,9 +93,7 @@ static void switch_segment(struct demuxer *demuxer, struct segment *new,
|
|||||||
double start_pts, int flags)
|
double start_pts, int flags)
|
||||||
{
|
{
|
||||||
struct priv *p = demuxer->priv;
|
struct priv *p = demuxer->priv;
|
||||||
|
bool new_segment = p->current != new;
|
||||||
if (p->current == new)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(flags & (SEEK_FORWARD | SEEK_BACKWARD)))
|
if (!(flags & (SEEK_FORWARD | SEEK_BACKWARD)))
|
||||||
flags |= SEEK_BACKWARD;
|
flags |= SEEK_BACKWARD;
|
||||||
@ -109,7 +107,8 @@ static void switch_segment(struct demuxer *demuxer, struct segment *new,
|
|||||||
|
|
||||||
for (int n = 0; n < p->num_streams; n++) {
|
for (int n = 0; n < p->num_streams; n++) {
|
||||||
struct virtual_stream *vs = &p->streams[n];
|
struct virtual_stream *vs = &p->streams[n];
|
||||||
vs->new_segment = true;
|
if (new_segment)
|
||||||
|
vs->new_segment = true;
|
||||||
vs->eos_packets = 0;
|
vs->eos_packets = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +131,6 @@ static void d_seek(struct demuxer *demuxer, double seek_pts, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p->current = NULL; // force seek
|
|
||||||
switch_segment(demuxer, new, pts, flags);
|
switch_segment(demuxer, new, pts, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user