From f6172eaa5f78d2af04e8e99fdf26b2b0ad4994d6 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期四, 01 八月 2019 15:51:19 +0800 Subject: [PATCH] bug fix record file thread quit dup pkt --- csrc/ffmpeg/format/FormatOut.cpp | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/csrc/ffmpeg/format/FormatOut.cpp b/csrc/ffmpeg/format/FormatOut.cpp index d319969..bc77524 100644 --- a/csrc/ffmpeg/format/FormatOut.cpp +++ b/csrc/ffmpeg/format/FormatOut.cpp @@ -339,7 +339,6 @@ char option_key[]="movflags"; char option_value[]="frag_keyframe+empty_moov"; av_dict_set(&avdic,option_key,option_value,0); - flag = writeHeader(&avdic); av_dict_free(&avdic); @@ -397,12 +396,17 @@ AVRational time_base_q = { 1, AV_TIME_BASE }; //Duration between 2 frames (us) - int64_t calc_duration = (double)(AV_TIME_BASE)*(1 / fps_); //鍐呴儴鏃堕棿鎴� + // int64_t calc_duration = (double)(AV_TIME_BASE)*(1 / fps_); //鍐呴儴鏃堕棿鎴� + int64_t calc_duration = (int64_t)(AV_TIME_BASE / fps_); //鍐呴儴鏃堕棿鎴� //Parameters pkt.pts = av_rescale_q(time_stamp*calc_duration, time_base_q, time_base); pkt.dts = pkt.pts; pkt.duration = av_rescale_q(calc_duration, time_base_q, time_base); //(double)(calc_duration)*(double)(av_q2d(time_base_q)) / (double)(av_q2d(time_base)); + // if (pkt.duration < 0 || time_base.den != 90000){ + // logIt("CALCULATE DURATION : %lld, fame count : %lld, TIMEBASE: %d", calc_duration,time_stamp, time_base.den); + // } + } bool FormatOut::writeFrame(AVPacket &pkt, const int64_t &frame_cnt, -- Gitblit v1.8.0