[FFmpeg-devel] [PATCH v2] mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx

Zhao Zhili quinkblack at foxmail.com
Sun Aug 14 09:55:24 EEST 2022


On Fri, 2022-08-12 at 16:22 +0100, Derek Buitenhuis wrote:
> On 8/9/2022 10:38 AM, "zhilizhao(赵志立)" wrote:
> > It’s suspicious to return a timestamp with unknown timebase.
> 
> Would you suggest erroring in the case where there's no frag_stream?
> That could
> make sense.

Or just continue the loop, and print a warning message maybe?

@@ -1288,28 +1291,25 @@ static int64_t get_frag_time(MOVFragmentIndex
*frag_index,
     }
 
     for (i = 0; i < frag_index->item[index].nb_stream_info; i++) {
+        AVStream *frag_stream = NULL;
         frag_stream_info = &frag_index->item[index].stream_info[i];
+        for (j = 0; j < s->nb_streams; j++)
+            if (s->streams[j]->id == frag_stream_info->id)
+                frag_stream = s->streams[j];
+        if (!frag_stream)
+            continue;
         timestamp = get_stream_info_time(frag_stream_info);
         if (timestamp != AV_NOPTS_VALUE)
-            return timestamp;
+            return av_rescale_q(timestamp, frag_stream->time_base,
dst_st->time_base);
     }
     return AV_NOPTS_VALUE;
 }

> 
> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list