1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1636, fix bug for mux AAC to ADTS, never overwrite by RTMP sampling rate. 4.0.13

This commit is contained in:
winlin 2020-03-13 16:56:00 +08:00
parent c66f33ac87
commit aa20a04abb
6 changed files with 12 additions and 12 deletions

View file

@ -153,6 +153,7 @@ For previous versions, please read:
## V4 changes ## V4 changes
* v4.0, 2020-03-13, For [#1636][bug #1636], fix bug for mux AAC to ADTS, never overwrite by RTMP sampling rate. 4.0.13
* v4.0, 2020-03-07, For [#1612][bug #1612], fix crash bug for RTSP. 4.0.12 * v4.0, 2020-03-07, For [#1612][bug #1612], fix crash bug for RTSP. 4.0.12
* v4.0, 2020-03-07, For [#1631][bug #1631], support sei_filter for SRT. 4.0.11 * v4.0, 2020-03-07, For [#1631][bug #1631], support sei_filter for SRT. 4.0.11
* v4.0, 2020-03-01, For [#1621][bug #1621], support mix_correct for aggregate aac for SRT. 4.0.10 * v4.0, 2020-03-01, For [#1621][bug #1621], support mix_correct for aggregate aac for SRT. 4.0.10

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP #ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP
#define SRS_VERSION4_REVISION 12 #define SRS_VERSION4_REVISION 13
#endif #endif

View file

@ -304,6 +304,9 @@ extern int srs_flv_srates[];
*/ */
extern int srs_aac_srates[]; extern int srs_aac_srates[];
// The number of aac samplerates, size for srs_aac_srates.
#define SrsAAcSampleRateNumbers 16
// The impossible aac sample rate index. // The impossible aac sample rate index.
#define SrsAacSampleRateUnset 15 #define SrsAacSampleRateUnset 15

View file

@ -438,7 +438,6 @@ srs_error_t SrsRawAacStream::adts_demux(SrsBuffer* stream, char** pframe, int* p
srs_error_t SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh) srs_error_t SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
char samplingFrequencyIndex = codec->sampling_frequency_index;
// only support aac profile 1-4. // only support aac profile 1-4.
if (codec->aac_object == SrsAacObjectTypeReserved) { if (codec->aac_object == SrsAacObjectTypeReserved) {
@ -448,8 +447,9 @@ srs_error_t SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, st
SrsAacObjectType audioObjectType = codec->aac_object; SrsAacObjectType audioObjectType = codec->aac_object;
char channelConfiguration = codec->channel_configuration; char channelConfiguration = codec->channel_configuration;
if (samplingFrequencyIndex >= 16) { char samplingFrequencyIndex = codec->sampling_frequency_index;
samplingFrequencyIndex = 4;//default 44100 if (samplingFrequencyIndex >= SrsAAcSampleRateNumbers) {
samplingFrequencyIndex = 4; // Default to 44100
} }
char chs[2]; char chs[2];

View file

@ -30,11 +30,6 @@
#include <srs_kernel_codec.hpp> #include <srs_kernel_codec.hpp>
static const int mpeg4audio_sample_rates[16] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000, 7350
};
class SrsBuffer; class SrsBuffer;
// The raw h.264 stream, in annexb. // The raw h.264 stream, in annexb.

View file

@ -520,9 +520,10 @@ srs_error_t rtmp_client::on_ts_video(std::shared_ptr<SrsBuffer> avs_ptr, uint64_
int rtmp_client::get_sample_rate(char sample_index) { int rtmp_client::get_sample_rate(char sample_index) {
int sample_rate = 44100; int sample_rate = 44100;
if ((sample_index >= 0) && (sample_index < 16)) { if ((sample_index >= 0) && (sample_index < SrsAAcSampleRateNumbers)) {
sample_rate = mpeg4audio_sample_rates[sample_index]; sample_rate = srs_aac_srates[(uint8_t)sample_index];
} }
return sample_rate; return sample_rate;
} }