From 967368ce07ca472ca6d9a4d4bbbdf46049be1bb4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 30 Nov 2017 22:18:33 -0500 Subject: [PATCH] testing --- src/zm_monitor.cpp | 2 +- src/zm_videostore.cpp | 22 ++++++++++++++++++++-- web/skins/classic/views/console.php | 7 +++---- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 8fe1e0d1e..9c4e2af89 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1275,7 +1275,7 @@ bool Monitor::Analyse() { Debug(2, "skipping because audio"); if ( ! packetqueue.increment_analysis_it() ) { Debug(2, "No more packets to analyse"); - break; + return false; } continue; } diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 500dd380d..2aa5785f8 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -539,6 +539,8 @@ Debug(2,"Different codecs between in and out"); // The codec queues data. We need to send a flush command and out // whatever we get. Failures are not fatal. AVPacket pkt; + pkt.data = NULL; + pkt.size = 0; av_init_packet(&pkt); #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) @@ -604,6 +606,9 @@ Debug(3, "dts:%d, pts:%d, keyframe:%d", pkt.dts, pkt.pts, keyframe ); } #else while (1) { + pkt.data = NULL; + pkt.size = 0; + av_init_packet(&pkt); int got_packet = 0; ret = avcodec_encode_audio2(audio_out_ctx, &pkt, NULL, &got_packet); @@ -732,6 +737,10 @@ bool VideoStore::setup_resampler() { } Debug(2, "Have audio out codec"); + // Now copy them to the out stream + audio_out_stream = avformat_new_stream(oc, audio_out_codec); + +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) // audio_out_ctx = audio_out_stream->codec; audio_out_ctx = avcodec_alloc_context3(audio_out_codec); if ( !audio_out_ctx ) { @@ -739,6 +748,9 @@ bool VideoStore::setup_resampler() { audio_out_stream = NULL; return false; } +#else + audio_out_ctx = audio_out_stream->codec; +#endif /* put sample parameters */ audio_out_ctx->bit_rate = audio_in_ctx->bit_rate; @@ -776,8 +788,6 @@ bool VideoStore::setup_resampler() { audio_out_ctx->time_base = (AVRational){1, audio_out_ctx->sample_rate}; - // Now copy them to the out stream - audio_out_stream = avformat_new_stream(oc, audio_out_codec); #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) if ( (ret = avcodec_parameters_from_context(audio_out_stream->codecpar, @@ -785,6 +795,7 @@ bool VideoStore::setup_resampler() { Error("Could not initialize stream parameteres"); return false; } + audio_out_stream->codecpar->frame_size = audio_out_ctx->frame_size; #endif audio_out_stream->time_base = (AVRational){1, audio_out_ctx->sample_rate}; @@ -807,6 +818,13 @@ bool VideoStore::setup_resampler() { audio_out_ctx->channels, audio_out_ctx->sample_fmt, audio_out_ctx->channel_layout, audio_out_ctx->frame_size); + Debug(1, + "Audio out bit_rate (%d) sample_rate(%d) channels(%d) fmt(%d) " + "layout(%d) frame_size(%d)", + audio_out_stream->codec->bit_rate, audio_out_stream->codec->sample_rate, + audio_out_stream->codec->channels, audio_out_stream->codec->sample_fmt, + audio_out_stream->codec->channel_layout, audio_out_stream->codec->frame_size); + /** Create a new frame to store the audio samples. */ if ( ! in_frame ) { if (!(in_frame = zm_av_frame_alloc())) { diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 789c3b3ef..f2d8dc983 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -114,7 +114,6 @@ for ( $i = 0; $i < count($displayMonitors); $i++ ) { if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight; } $monitor['zmc'] = zmcStatus( $monitor ); - #$monitor['zma'] = zmaStatus( $monitor ); $zoneCount += $monitor['ZoneCount']; $counts = array(); @@ -189,9 +188,9 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) { $dclass = 'errorText'; } else { // https://github.com/ZoneMinder/ZoneMinder/issues/1082 - if ( !$monitor['zma'] && $monitor['Function']!='Monitor' ) - $dclass = 'warnText'; - else + //if ( a'] && $monitor['Function']!='Monitor' ) + //$dclass = 'warnText'; + //else $dclass = 'infoText'; } if ( $monitor['Function'] == 'None' )