diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-06-09 22:03:07 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-30 10:40:54 +0300 |
commit | 7616f4ae57735a66720d440f42c476a256d02350 (patch) | |
tree | 5a26bf796b71b92fe5ef8b12b128e4a22f675589 /intern/ffmpeg/ffmpeg_compat.h | |
parent | a68f5456e48b80825f1513b87c37463e7ad6cc3f (diff) |
Fix: VSE indexer seeking not working correctly
Because of the added sanity checks in rB14508ef100c9 (D11492), seeking
in proxies would not work correctly any more. This is because it wasn't
working as intended before, but in most cases this wouldn't be
noticeable. However now when the sanity checks are tripped it is very
noticeable that something is wrong
The indexer tried to use dts values for time stamps when we used pts in
our decode functions to get the time positions. This would make it
start in the wrong GOP frames when searching. Now that we enforce no
crossing of GOP frames when decoding after seek, this would lead to
issues.
Now we correctly use pts (or dts if pts is not available) and thus we
don't have any seeking issues because of time stamp format missmatch.
Reviewed By: Richard Antalik
Differential Revision: http://developer.blender.org/D11561
Diffstat (limited to 'intern/ffmpeg/ffmpeg_compat.h')
-rw-r--r-- | intern/ffmpeg/ffmpeg_compat.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index 3f168894cd9..6fefa164dc3 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -113,25 +113,28 @@ void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp) } FFMPEG_INLINE -int64_t av_get_pts_from_frame(AVFormatContext *avctx, AVFrame *picture) +int64_t timestamp_from_pts_or_dts(int64_t pts, int64_t dts) { - int64_t pts; - pts = picture->pts; - - if (pts == AV_NOPTS_VALUE) { - pts = picture->pkt_dts; - } + /* Some videos do not have any pts values, use dts instead in those cases if + * possible. Usually when this happens dts can act as pts because as all frames + * should then be presented in their decoded in order. IE pts == dts. */ if (pts == AV_NOPTS_VALUE) { - pts = 0; + return dts; } - - (void)avctx; return pts; } -/* --- Deinterlace code block begin --- */ +FFMPEG_INLINE +int64_t av_get_pts_from_frame(AVFrame *picture) +{ + return timestamp_from_pts_or_dts(picture->pts, picture->pkt_dts); +} -/* NOTE: The code in this block are from FFmpeg 2.6.4, which is licensed by LGPL. */ +/* -------------------------------------------------------------------- */ +/** \name Deinterlace code block + * + * NOTE: The code in this block are from FFmpeg 2.6.4, which is licensed by LGPL. + * \{ */ #define MAX_NEG_CROP 1024 |