From 602b3b2a792d65e49dba07920b100b5feb39d36f Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 16 九月 2019 13:43:40 +0800
Subject: [PATCH] remove log

---
 csrc/ffmpeg/format/FormatOut.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/csrc/ffmpeg/format/FormatOut.cpp b/csrc/ffmpeg/format/FormatOut.cpp
index 3837dbc..804c8ed 100644
--- a/csrc/ffmpeg/format/FormatOut.cpp
+++ b/csrc/ffmpeg/format/FormatOut.cpp
@@ -160,6 +160,9 @@
         if(prop.gpuAccl()){
             av_opt_set(enc_ctx_->priv_data, "preset", "llhp", 0);
             int idle_gpu = gpu::getGPU(120);
+            if (prop.gpu_index_ > -1){
+                idle_gpu = prop.gpu_index_;
+            }
             if(idle_gpu < 0){
                 logIt("NO GPU RESOURCE TO ENCODE");
                 return false;
@@ -336,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);
 
@@ -362,6 +364,7 @@
     bool FormatOut::endWriter(){
 
         auto flag =  writeTrailer();
+        closeResource();
         record_ = false;
 
         return flag;
@@ -394,12 +397,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