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

support all sample rate in aac

This commit is contained in:
runner365 2020-03-12 20:30:07 +08:00
parent a2839aacdf
commit b9195122cf
3 changed files with 13 additions and 31 deletions

View file

@ -438,7 +438,8 @@ 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 err = srs_success;
char samplingFrequencyIndex = codec->sampling_frequency_index;
// only support aac profile 1-4.
if (codec->aac_object == SrsAacObjectTypeReserved) {
return srs_error_new(ERROR_AAC_DATA_INVALID, "invalid aac object");
@ -446,21 +447,11 @@ srs_error_t SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, st
SrsAacObjectType audioObjectType = codec->aac_object;
char channelConfiguration = codec->channel_configuration;
char samplingFrequencyIndex = codec->sampling_frequency_index;
// override the aac samplerate by user specified.
// @see https://github.com/ossrs/srs/issues/212#issuecomment-64146899
switch (codec->sound_rate) {
case SrsAudioSampleRate11025:
samplingFrequencyIndex = 0x0a; break;
case SrsAudioSampleRate22050:
samplingFrequencyIndex = 0x07; break;
case SrsAudioSampleRate44100:
samplingFrequencyIndex = 0x04; break;
default:
break;
if (samplingFrequencyIndex >= 16) {
samplingFrequencyIndex = 4;//default 44100
}
char chs[2];
// @see ISO_IEC_14496-3-AAC-2001.pdf
// AudioSpecificConfig (), page 33

View file

@ -30,6 +30,11 @@
#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;
// The raw h.264 stream, in annexb.