Commit 9943c5a4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9257692a'

* commit '9257692a':
  lavf: Only initialize s->offset once when using avoid_negative_ts make_zero

Conflicts:
	libavformat/mux.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents afbaa9a7 9257692a
......@@ -557,13 +557,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = s->streams[pkt->stream_index];
int64_t offset = st->mux_ts_offset;
if (!s->offset && pkt->dts != AV_NOPTS_VALUE &&
if (s->offset == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE &&
(pkt->dts < 0 || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) {
s->offset = -pkt->dts;
s->offset_timebase = st->time_base;
}
if (s->offset && !offset) {
if (s->offset != AV_NOPTS_VALUE && !offset) {
offset = st->mux_ts_offset =
av_rescale_q_rnd(s->offset,
s->offset_timebase,
......
......@@ -110,6 +110,7 @@ AVFormatContext *avformat_alloc_context(void)
ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic;
avformat_get_context_defaults(ic);
ic->offset = AV_NOPTS_VALUE;
ic->internal = av_mallocz(sizeof(*ic->internal));
if (!ic->internal) {
......
b1106bfcdbd1bb12be9161320351dd00 *./tests/data/lavf/lavf.ismv
a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv
312542 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0xb7d29d29
c8bea6c84b6274f14042381045b0f532 *./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0x9d9a638a
440d85f9fd5b9f63c2676638782b5c15 *./tests/data/lavf/lavf.ismv
321448 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0x33834815
b1106bfcdbd1bb12be9161320351dd00 *./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0xe8130120
a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv
312542 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0xb7d29d29
./tests/data/lavf/lavf.ismv CRC=0x9d9a638a
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment