From 01d9022b47e5e20f39ca1115d334c43774378dfc Mon Sep 17 00:00:00 2001
From: zhangmeng <zhangmeng@aiiot.com>
Date: 星期三, 25 三月 2020 13:56:16 +0800
Subject: [PATCH] add log for local video

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

diff --git a/csrc/ffmpeg/format/FormatOut.cpp b/csrc/ffmpeg/format/FormatOut.cpp
index 6bc43df..e832bfe 100644
--- a/csrc/ffmpeg/format/FormatOut.cpp
+++ b/csrc/ffmpeg/format/FormatOut.cpp
@@ -293,7 +293,7 @@
             logIt("Failed to copy context from input to output stream codec context\n");
             return false;
         }
-        out_stream->codecpar->codec_tag = out_stream->codec->codec_tag = 0;
+        out_stream->codecpar->codec_tag = 0;
         
         if(ctx_->oformat->flags & AVFMT_GLOBALHEADER)
             out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
@@ -399,7 +399,7 @@
         int out_idx = -1;
         std::vector<AVStream*> in_streams{in_v_stream_, in_a_stream_};
         for (auto i : in_streams){
-            if (i->index == pkt->stream_index){
+            if (i && (i->index == pkt->stream_index)){
                 if (i->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){
                     out_idx = v_idx_;
                     in_stream = i;

--
Gitblit v1.8.0