diff mbox series

[FFmpeg-devel,v2,3/3] avformat/flvenc: fix shadowed variable ts

Message ID tencent_7870272DDA9AD240659A289F77AB844E1C08@qq.com
State New
Headers show
Series avformat/flv: fix timestamps of key frame index | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

zhilizhao(赵志立) July 29, 2022, 4:43 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavformat/flvenc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 1c4ffb985a..5d574fa790 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -993,12 +993,9 @@  static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
                 flv->videosize += (avio_tell(pb) - cur_offset);
                 flv->lasttimestamp = pkt->dts / 1000.0;
                 if (pkt->flags & AV_PKT_FLAG_KEY) {
-                    double ts = flv->lasttimestamp;
-                    int64_t pos = cur_offset;
-
-                    flv->lastkeyframetimestamp = ts;
-                    flv->lastkeyframelocation = pos;
-                    ret = flv_append_keyframe_info(s, flv, ts, pos);
+                    flv->lastkeyframetimestamp = flv->lasttimestamp;
+                    flv->lastkeyframelocation = cur_offset;
+                    ret = flv_append_keyframe_info(s, flv, flv->lasttimestamp, cur_offset);
                     if (ret < 0)
                         goto fail;
                 }