winlin

increase the nb_samples because some large video may overflow.

@@ -353,10 +353,9 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size) @@ -353,10 +353,9 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
353 { 353 {
354 int ret = ERROR_SUCCESS; 354 int ret = ERROR_SUCCESS;
355 355
356 - if (nb_sample_units >= SRS_SRS_MAX_CODEC_SAMPLE) { 356 + if (nb_sample_units >= SRS_MAX_CODEC_SAMPLE) {
357 ret = ERROR_HLS_DECODE_ERROR; 357 ret = ERROR_HLS_DECODE_ERROR;
358 - srs_error("hls decode samples error, "  
359 - "exceed the max count: %d, ret=%d", SRS_SRS_MAX_CODEC_SAMPLE, ret); 358 + srs_error("avc exceed samples count, max=%d, video=%d. ret=%d", SRS_MAX_CODEC_SAMPLE, is_video, ret);
360 return ret; 359 return ret;
361 } 360 }
362 361
@@ -243,9 +243,12 @@ extern int flv_sample_rates[]; @@ -243,9 +243,12 @@ extern int flv_sample_rates[];
243 */ 243 */
244 extern int aac_sample_rates[]; 244 extern int aac_sample_rates[];
245 245
246 -#define SRS_SRS_MAX_CODEC_SAMPLE 128 246 +// The impossible aac sample rate index.
247 #define SRS_AAC_SAMPLE_RATE_UNSET 15 247 #define SRS_AAC_SAMPLE_RATE_UNSET 15
248 248
  249 +// The max number of NALUs in a video, or aac frame in audio packet.
  250 +#define SRS_MAX_CODEC_SAMPLE 256
  251 +
249 /** 252 /**
250 * the FLV/RTMP supported audio sample size. 253 * the FLV/RTMP supported audio sample size.
251 * Size of each audio sample. This parameter only pertains to 254 * Size of each audio sample. This parameter only pertains to
@@ -368,7 +371,7 @@ public: @@ -368,7 +371,7 @@ public:
368 * where avc/h264 video packet may contains multiple buffer. 371 * where avc/h264 video packet may contains multiple buffer.
369 */ 372 */
370 int nb_sample_units; 373 int nb_sample_units;
371 - SrsCodecSampleUnit sample_units[SRS_SRS_MAX_CODEC_SAMPLE]; 374 + SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE];
372 public: 375 public:
373 /** 376 /**
374 * whether the sample is video sample which demux from video packet. 377 * whether the sample is video sample which demux from video packet.