1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00
FFmpeg/libavformat
Matthieu Bouron 2e17435480 avformat/mov: adjust skip_samples according to seek timestamp
Currently skip_samples is set to start_pad if sample_time is lesser or
equal to 0. This can cause issues if the stream starts with packets that
have negative pts. Calling avformat_seek_file() with ts set to 0 on such
streams makes the mov demuxer return the right corresponding packets
(near the 0 timestamp) but set skip_samples to start_pad which is
incorrect as the audio decoder will discard the returned samples
according to skip_samples from the first packet it receives (which has
its timestamp near 0).

For example, considering the following audio stream with start_pad=1344:

 [PKT pts=-1344] [PKT pts=-320] [PKT pts=704] [PKT pts=1728] [...]

Calling avformat_seek_file() with ts=0 makes the next call to
av_read_frame() return the packet with pts=-320 and a skip samples
side data set to 1344 (start_pad). This makes the audio decoder
incorrectly discard (1344 - 320) samples.

This commit makes the move demuxer adjust skip_samples according to the
stream start_pad, seek timestamp and first sample timestamp.

The above example will now result in av_read_frame() still returning the
packet with pts=-320 but with a skip samples side data set to 320
(src_pad - (seek_timestamp - first_timestamp)). This makes the audio
decoder only discard 320 samples (from pts=-320 to pts=0).

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 17:08:27 +01:00
..
2020-10-03 21:50:59 +02:00
2020-11-04 23:30:53 +01:00
2020-10-25 23:44:26 +10:00
2020-11-09 14:58:38 +10:00
2020-10-06 00:01:35 +08:00
2020-10-06 00:01:27 +08:00
2020-11-11 17:05:24 +01:00
2020-12-24 15:25:00 +01:00
2020-10-24 19:11:12 +02:00
2020-11-04 23:30:53 +01:00
2020-12-12 00:13:58 +01:00
2020-10-07 22:16:09 +02:00
2020-09-24 13:38:28 +02:00
2020-12-21 01:27:33 -05:00
2020-10-25 09:49:26 +01:00
2020-09-18 11:30:03 +02:00
2020-06-18 21:31:13 +02:00
2020-09-03 18:11:00 +02:00
2020-11-22 17:45:17 +01:00
2020-09-03 18:03:18 +02:00
2020-10-24 19:11:12 +02:00
2020-10-25 09:49:31 +01:00
2020-09-13 16:05:01 +02:00
2020-10-22 20:53:57 +08:00
2020-12-05 00:08:33 +01:00
2020-07-26 16:47:01 +02:00
2020-10-21 17:21:41 +02:00