]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
Merge commit '4d7ab5cfebef91820af2933ef2f622ea598e6b53'
[ffmpeg] / libavformat / utils.c
index 2be4279b45e3dce8bce87ade72bd0248d33768dc..e859ad21c71960d564c45b9dfda3007e67a2e0bf 100644 (file)
@@ -1154,7 +1154,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     /* Interpolate PTS and DTS if they are not present. We skip H264
      * currently because delay and has_b_frames are not reliably set. */
     if ((delay == 0 || (delay == 1 && pc)) &&
-        st->codec->codec_id != AV_CODEC_ID_H264) {
+        st->codec->codec_id != AV_CODEC_ID_H264 &&
+        st->codec->codec_id != AV_CODEC_ID_HEVC) {
         if (presentation_delayed) {
             /* DTS = decompression timestamp */
             /* PTS = presentation timestamp */
@@ -1199,7 +1200,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             pkt->dts = st->pts_buffer[0];
     }
     // We skipped it above so we try here.
-    if (st->codec->codec_id == AV_CODEC_ID_H264)
+    if (st->codec->codec_id == AV_CODEC_ID_H264 ||
+        st->codec->codec_id == AV_CODEC_ID_HEVC)
         // This should happen on the first packet
         update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts, pkt);
     if (pkt->dts > st->cur_dts)
@@ -3373,7 +3375,8 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
             continue;
         if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
             continue;
-        if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED |
+        if (wanted_stream_nb != real_stream_index &&
+            st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED |
                                AV_DISPOSITION_VISUAL_IMPAIRED))
             continue;
         if (type == AVMEDIA_TYPE_AUDIO && !avctx->channels)