Browse Source

deps/media-playback: Fix invalid seek at reset

When AVFormatContext->startime is set to AV_NO_PTS
mp_media_reset try to seek to INT64_MIN
use 0 instead.
Fix loop with aac file
mvji 3 years ago
parent
commit
f0b3593349
1 changed files with 4 additions and 1 deletions
  1. 4 1
      deps/media-playback/media-playback/media.c

+ 4 - 1
deps/media-playback/media-playback/media.c

@@ -558,12 +558,15 @@ static bool mp_media_reset(mp_media_t *m)
 
 	int64_t next_ts = mp_media_get_base_pts(m);
 	int64_t offset = next_ts - m->next_pts_ns;
+	int64_t start_time = m->fmt->start_time;
+	if (start_time == AV_NOPTS_VALUE)
+		start_time = 0;
 
 	m->eof = false;
 	m->base_ts += next_ts;
 	m->seek_next_ts = false;
 
-	seek_to(m, m->fmt->start_time);
+	seek_to(m, start_time);
 
 	pthread_mutex_lock(&m->mutex);
 	stopping = m->stopping;