summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/demux/demux.c b/demux/demux.c
index e09a4e843c..49e75ef48f 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -416,6 +416,9 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp);
static struct demux_packet *advance_reader_head(struct demux_stream *ds);
static bool queue_seek(struct demux_internal *in, double seek_pts, int flags,
bool clear_back_state);
+static struct demux_packet *compute_keyframe_times(struct demux_packet *pkt,
+ double *out_kf_min,
+ double *out_kf_max);
static uint64_t get_foward_buffered_bytes(struct demux_stream *ds)
{
@@ -1444,12 +1447,8 @@ static void find_backward_restart_pos(struct demux_stream *ds)
assert(0); // target must be in list
}
- double seek_pts = MP_NOPTS_VALUE;
- for (struct demux_packet *cur = target; cur; cur = cur->next) {
- seek_pts = MP_PTS_MIN(seek_pts, cur->pts);
- if (cur->next && cur->next->keyframe)
- break;
- }
+ double seek_pts;
+ compute_keyframe_times(target, &seek_pts, NULL);
if (seek_pts != MP_NOPTS_VALUE)
ds->back_seek_pos = seek_pts;