From 2ef1ef06e93d6b353b7dd843960418babbf907aa Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 18 Jan 2017 11:11:36 +0800 Subject: [PATCH] increase the nb_samples because some large video may overflow. --- trunk/src/kernel/srs_kernel_codec.cpp | 5 ++--- trunk/src/kernel/srs_kernel_codec.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/trunk/src/kernel/srs_kernel_codec.cpp b/trunk/src/kernel/srs_kernel_codec.cpp index f36ed8325..7ba9cb69d 100644 --- a/trunk/src/kernel/srs_kernel_codec.cpp +++ b/trunk/src/kernel/srs_kernel_codec.cpp @@ -353,10 +353,9 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size) { int ret = ERROR_SUCCESS; - if (nb_sample_units >= SRS_SRS_MAX_CODEC_SAMPLE) { + if (nb_sample_units >= SRS_MAX_CODEC_SAMPLE) { ret = ERROR_HLS_DECODE_ERROR; - srs_error("hls decode samples error, " - "exceed the max count: %d, ret=%d", SRS_SRS_MAX_CODEC_SAMPLE, ret); + srs_error("avc exceed samples count, max=%d, video=%d. ret=%d", SRS_MAX_CODEC_SAMPLE, is_video, ret); return ret; } diff --git a/trunk/src/kernel/srs_kernel_codec.hpp b/trunk/src/kernel/srs_kernel_codec.hpp index 426c83fb4..149e16ce5 100644 --- a/trunk/src/kernel/srs_kernel_codec.hpp +++ b/trunk/src/kernel/srs_kernel_codec.hpp @@ -243,9 +243,12 @@ extern int flv_sample_rates[]; */ extern int aac_sample_rates[]; -#define SRS_SRS_MAX_CODEC_SAMPLE 128 +// The impossible aac sample rate index. #define SRS_AAC_SAMPLE_RATE_UNSET 15 +// The max number of NALUs in a video, or aac frame in audio packet. +#define SRS_MAX_CODEC_SAMPLE 256 + /** * the FLV/RTMP supported audio sample size. * Size of each audio sample. This parameter only pertains to @@ -368,7 +371,7 @@ public: * where avc/h264 video packet may contains multiple buffer. */ int nb_sample_units; - SrsCodecSampleUnit sample_units[SRS_SRS_MAX_CODEC_SAMPLE]; + SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE]; public: /** * whether the sample is video sample which demux from video packet.