mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-08 02:06:02 +08:00
avformat/mux: use a local variable for offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -499,14 +499,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
|
|
||||||
if (s->avoid_negative_ts > 0) {
|
if (s->avoid_negative_ts > 0) {
|
||||||
AVStream *st = s->streams[pkt->stream_index];
|
AVStream *st = s->streams[pkt->stream_index];
|
||||||
|
int64_t offset = st->mux_ts_offset;
|
||||||
|
|
||||||
if (pkt->dts < 0 && pkt->dts != AV_NOPTS_VALUE && !s->offset) {
|
if (pkt->dts < 0 && pkt->dts != AV_NOPTS_VALUE && !s->offset) {
|
||||||
s->offset = -pkt->dts;
|
s->offset = -pkt->dts;
|
||||||
s->offset_timebase = st->time_base;
|
s->offset_timebase = st->time_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->offset && !st->mux_ts_offset) {
|
if (s->offset && !offset) {
|
||||||
st->mux_ts_offset =
|
offset = st->mux_ts_offset =
|
||||||
av_rescale_q_rnd(s->offset,
|
av_rescale_q_rnd(s->offset,
|
||||||
s->offset_timebase,
|
s->offset_timebase,
|
||||||
st->time_base,
|
st->time_base,
|
||||||
@@ -514,9 +515,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pkt->dts != AV_NOPTS_VALUE)
|
if (pkt->dts != AV_NOPTS_VALUE)
|
||||||
pkt->dts += st->mux_ts_offset;
|
pkt->dts += offset;
|
||||||
if (pkt->pts != AV_NOPTS_VALUE)
|
if (pkt->pts != AV_NOPTS_VALUE)
|
||||||
pkt->pts += st->mux_ts_offset;
|
pkt->pts += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) && 0) {
|
if (!(s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) && 0) {
|
||||||
|
Reference in New Issue
Block a user