From 3d0cf84664ece3a28116896d2dd4cd7d093bcf59 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 21 Mar 2016 13:44:43 +0300 Subject: [PATCH] driver/record.cpp, driver/streamts.cpp: ignore bitstream filter errors Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/59c4b4237663223744aba01d4edf031a03571504 Author: [CST] Focus Date: 2016-03-21 (Mon, 21 Mar 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/record.cpp | 12 ++++-------- src/driver/streamts.cpp | 13 ++++--------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index b608b2ada..a9be1ea70 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1862,6 +1862,7 @@ CStreamRec::CStreamRec(const CTimerd::RecordingInfo * const eventinfo, std::stri ofcx = NULL; stopped = true; interrupt = false; + bsfc = NULL; } CStreamRec::~CStreamRec() @@ -2170,16 +2171,11 @@ void CStreamRec::run() if (bsfc && codec->codec_id == CODEC_ID_H264) { AVPacket newpkt = pkt; - int len; - if ((len = av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY)) < 0) { + if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { av_free_packet(&pkt); - continue; + newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); + pkt = newpkt; } - - av_free_packet(&pkt); - - newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); - pkt = newpkt; } pkt.pts = av_rescale_q(pkt.pts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index e5a6b1e48..f729fe580 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -891,16 +891,11 @@ void CStreamStream::run() if (bsfc && codec->codec_id == CODEC_ID_H264 ) { AVPacket newpkt = pkt; - int len; - if ((len = av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY)) < 0) { + if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { av_free_packet(&pkt); - continue; - } - - av_free_packet(&pkt); - - newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); - pkt = newpkt; + newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); + pkt = newpkt; + } } pkt.pts = av_rescale_q(pkt.pts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base);