正在显示
10 个修改的文件
包含
23 行增加
和
21 行删除
@@ -1397,15 +1397,15 @@ int SrsSource::on_audio(SrsCommonMessage* __audio) | @@ -1397,15 +1397,15 @@ int SrsSource::on_audio(SrsCommonMessage* __audio) | ||
1397 | 1397 | ||
1398 | // when got audio stream info. | 1398 | // when got audio stream info. |
1399 | SrsStatistic* stat = SrsStatistic::instance(); | 1399 | SrsStatistic* stat = SrsStatistic::instance(); |
1400 | - if ((ret = stat->on_audio_info(_req, SrsCodecAudioAAC, sample.sound_rate, sample.sound_type, codec.aac_profile)) != ERROR_SUCCESS) { | 1400 | + if ((ret = stat->on_audio_info(_req, SrsCodecAudioAAC, sample.sound_rate, sample.sound_type, codec.aac_object)) != ERROR_SUCCESS) { |
1401 | return ret; | 1401 | return ret; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | srs_trace("%dB audio sh, " | 1404 | srs_trace("%dB audio sh, " |
1405 | - "codec(%d, profile=%d, %dchannels, %dkbps, %dHZ), " | 1405 | + "codec(%d, profile=%s, %dchannels, %dkbps, %dHZ), " |
1406 | "flv(%dbits, %dchannels, %dHZ)", | 1406 | "flv(%dbits, %dchannels, %dHZ)", |
1407 | msg.size, codec.audio_codec_id, | 1407 | msg.size, codec.audio_codec_id, |
1408 | - codec.aac_profile, codec.aac_channels, | 1408 | + srs_codec_aac_object2str(codec.aac_object).c_str(), codec.aac_channels, |
1409 | codec.audio_data_rate / 1000, aac_sample_rates[codec.aac_sample_rate], | 1409 | codec.audio_data_rate / 1000, aac_sample_rates[codec.aac_sample_rate], |
1410 | flv_sample_sizes[sample.sound_size], flv_sound_types[sample.sound_type], | 1410 | flv_sample_sizes[sample.sound_size], flv_sound_types[sample.sound_type], |
1411 | flv_sample_rates[sample.sound_rate]); | 1411 | flv_sample_rates[sample.sound_rate]); |
@@ -60,7 +60,7 @@ SrsStatisticStream::SrsStatisticStream() | @@ -60,7 +60,7 @@ SrsStatisticStream::SrsStatisticStream() | ||
60 | acodec = SrsCodecAudioReserved1; | 60 | acodec = SrsCodecAudioReserved1; |
61 | asample_rate = SrsCodecAudioSampleRateReserved; | 61 | asample_rate = SrsCodecAudioSampleRateReserved; |
62 | asound_type = SrsCodecAudioSoundTypeReserved; | 62 | asound_type = SrsCodecAudioSoundTypeReserved; |
63 | - aac_profile = SrsAacProfileReserved; | 63 | + aac_object = SrsAacObjectTypeReserved; |
64 | } | 64 | } |
65 | 65 | ||
66 | SrsStatisticStream::~SrsStatisticStream() | 66 | SrsStatisticStream::~SrsStatisticStream() |
@@ -128,7 +128,7 @@ int SrsStatistic::on_video_info(SrsRequest* req, | @@ -128,7 +128,7 @@ int SrsStatistic::on_video_info(SrsRequest* req, | ||
128 | 128 | ||
129 | int SrsStatistic::on_audio_info(SrsRequest* req, | 129 | int SrsStatistic::on_audio_info(SrsRequest* req, |
130 | SrsCodecAudio acodec, SrsCodecAudioSampleRate asample_rate, SrsCodecAudioSoundType asound_type, | 130 | SrsCodecAudio acodec, SrsCodecAudioSampleRate asample_rate, SrsCodecAudioSoundType asound_type, |
131 | - SrsAacProfile aac_profile | 131 | + SrsAacObjectType aac_object |
132 | ) { | 132 | ) { |
133 | int ret = ERROR_SUCCESS; | 133 | int ret = ERROR_SUCCESS; |
134 | 134 | ||
@@ -139,7 +139,7 @@ int SrsStatistic::on_audio_info(SrsRequest* req, | @@ -139,7 +139,7 @@ int SrsStatistic::on_audio_info(SrsRequest* req, | ||
139 | stream->acodec = acodec; | 139 | stream->acodec = acodec; |
140 | stream->asample_rate = asample_rate; | 140 | stream->asample_rate = asample_rate; |
141 | stream->asound_type = asound_type; | 141 | stream->asound_type = asound_type; |
142 | - stream->aac_profile = aac_profile; | 142 | + stream->aac_object = aac_object; |
143 | 143 | ||
144 | return ret; | 144 | return ret; |
145 | } | 145 | } |
@@ -257,7 +257,7 @@ int SrsStatistic::dumps_streams(stringstream& ss) | @@ -257,7 +257,7 @@ int SrsStatistic::dumps_streams(stringstream& ss) | ||
257 | << __SRS_JFIELD_STR("codec", srs_codec_audio2str(stream->acodec)) << __SRS_JFIELD_CONT | 257 | << __SRS_JFIELD_STR("codec", srs_codec_audio2str(stream->acodec)) << __SRS_JFIELD_CONT |
258 | << __SRS_JFIELD_ORG("sample_rate", (int)flv_sample_rates[stream->asample_rate]) << __SRS_JFIELD_CONT | 258 | << __SRS_JFIELD_ORG("sample_rate", (int)flv_sample_rates[stream->asample_rate]) << __SRS_JFIELD_CONT |
259 | << __SRS_JFIELD_ORG("channel", (int)stream->asound_type + 1) << __SRS_JFIELD_CONT | 259 | << __SRS_JFIELD_ORG("channel", (int)stream->asound_type + 1) << __SRS_JFIELD_CONT |
260 | - << __SRS_JFIELD_STR("profile", srs_codec_aac_profile2str(stream->aac_profile)) | 260 | + << __SRS_JFIELD_STR("profile", srs_codec_aac_object2str(stream->aac_object)) |
261 | << __SRS_JOBJECT_END; | 261 | << __SRS_JOBJECT_END; |
262 | } | 262 | } |
263 | 263 |
@@ -73,7 +73,7 @@ public: | @@ -73,7 +73,7 @@ public: | ||
73 | * 1.5.1.1 Audio object type definition, page 23, | 73 | * 1.5.1.1 Audio object type definition, page 23, |
74 | * in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf. | 74 | * in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf. |
75 | */ | 75 | */ |
76 | - SrsAacProfile aac_profile; | 76 | + SrsAacObjectType aac_object; |
77 | public: | 77 | public: |
78 | SrsStatisticStream(); | 78 | SrsStatisticStream(); |
79 | virtual ~SrsStatisticStream(); | 79 | virtual ~SrsStatisticStream(); |
@@ -120,7 +120,7 @@ public: | @@ -120,7 +120,7 @@ public: | ||
120 | */ | 120 | */ |
121 | virtual int on_audio_info(SrsRequest* req, | 121 | virtual int on_audio_info(SrsRequest* req, |
122 | SrsCodecAudio acodec, SrsCodecAudioSampleRate asample_rate, SrsCodecAudioSoundType asound_type, | 122 | SrsCodecAudio acodec, SrsCodecAudioSampleRate asample_rate, SrsCodecAudioSoundType asound_type, |
123 | - SrsAacProfile aac_profile | 123 | + SrsAacObjectType aac_object |
124 | ); | 124 | ); |
125 | /** | 125 | /** |
126 | * when close stream. | 126 | * when close stream. |
@@ -43,7 +43,7 @@ SrsAacEncoder::SrsAacEncoder() | @@ -43,7 +43,7 @@ SrsAacEncoder::SrsAacEncoder() | ||
43 | _fs = NULL; | 43 | _fs = NULL; |
44 | got_sequence_header = false; | 44 | got_sequence_header = false; |
45 | tag_stream = new SrsStream(); | 45 | tag_stream = new SrsStream(); |
46 | - aac_profile = SrsAacProfileReserved; | 46 | + aac_object = SrsAacObjectTypeReserved; |
47 | } | 47 | } |
48 | 48 | ||
49 | SrsAacEncoder::~SrsAacEncoder() | 49 | SrsAacEncoder::~SrsAacEncoder() |
@@ -131,7 +131,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) | @@ -131,7 +131,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) | ||
131 | aac_sample_rate = ((audioObjectType << 1) & 0x0e) | ((aac_sample_rate >> 7) & 0x01); | 131 | aac_sample_rate = ((audioObjectType << 1) & 0x0e) | ((aac_sample_rate >> 7) & 0x01); |
132 | 132 | ||
133 | audioObjectType = (audioObjectType >> 3) & 0x1f; | 133 | audioObjectType = (audioObjectType >> 3) & 0x1f; |
134 | - aac_profile = srs_codec_aac_rtmp2ts((SrsAacObjectType)audioObjectType); | 134 | + aac_object = (SrsAacObjectType)audioObjectType; |
135 | 135 | ||
136 | got_sequence_header = true; | 136 | got_sequence_header = true; |
137 | 137 | ||
@@ -186,6 +186,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) | @@ -186,6 +186,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) | ||
186 | // channel_configuration 3 uimsbf | 186 | // channel_configuration 3 uimsbf |
187 | // original/copy 1 bslbf | 187 | // original/copy 1 bslbf |
188 | // home 1 bslbf | 188 | // home 1 bslbf |
189 | + SrsAacProfile aac_profile = srs_codec_aac_rtmp2ts(aac_object); | ||
189 | *pp++ = ((aac_profile << 6) & 0xc0) | ((aac_sample_rate << 2) & 0x3c) | ((aac_channels >> 2) & 0x01); | 190 | *pp++ = ((aac_profile << 6) & 0xc0) | ((aac_sample_rate << 2) & 0x3c) | ((aac_channels >> 2) & 0x01); |
190 | // 4bits left. | 191 | // 4bits left. |
191 | // adts_variable_header(), 1.A.2.2.2 Variable Header of ADTS | 192 | // adts_variable_header(), 1.A.2.2.2 Variable Header of ADTS |
@@ -45,7 +45,7 @@ class SrsAacEncoder | @@ -45,7 +45,7 @@ class SrsAacEncoder | ||
45 | private: | 45 | private: |
46 | SrsFileWriter* _fs; | 46 | SrsFileWriter* _fs; |
47 | private: | 47 | private: |
48 | - SrsAacProfile aac_profile; | 48 | + SrsAacObjectType aac_object; |
49 | int8_t aac_sample_rate; | 49 | int8_t aac_sample_rate; |
50 | int8_t aac_channels; | 50 | int8_t aac_channels; |
51 | bool got_sequence_header; | 51 | bool got_sequence_header; |
@@ -294,7 +294,7 @@ SrsAvcAacCodec::SrsAvcAacCodec() | @@ -294,7 +294,7 @@ SrsAvcAacCodec::SrsAvcAacCodec() | ||
294 | 294 | ||
295 | avc_profile = 0; | 295 | avc_profile = 0; |
296 | avc_level = 0; | 296 | avc_level = 0; |
297 | - aac_profile = SrsAacProfileReserved; | 297 | + aac_object = SrsAacObjectTypeReserved; |
298 | aac_sample_rate = __SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored | 298 | aac_sample_rate = __SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored |
299 | aac_channels = 0; | 299 | aac_channels = 0; |
300 | avc_extra_size = 0; | 300 | avc_extra_size = 0; |
@@ -493,8 +493,8 @@ int SrsAvcAacCodec::audio_aac_sequence_header_demux(char* data, int size) | @@ -493,8 +493,8 @@ int SrsAvcAacCodec::audio_aac_sequence_header_demux(char* data, int size) | ||
493 | aac_sample_rate = samplingFrequencyIndex; | 493 | aac_sample_rate = samplingFrequencyIndex; |
494 | 494 | ||
495 | // convert the object type in sequence header to aac profile of ADTS. | 495 | // convert the object type in sequence header to aac profile of ADTS. |
496 | - aac_profile = srs_codec_aac_rtmp2ts((SrsAacObjectType)profile_ObjectType); | ||
497 | - if (aac_profile == SrsAacProfileReserved) { | 496 | + aac_object = (SrsAacObjectType)profile_ObjectType; |
497 | + if (aac_object == SrsAacObjectTypeReserved) { | ||
498 | ret = ERROR_HLS_DECODE_ERROR; | 498 | ret = ERROR_HLS_DECODE_ERROR; |
499 | srs_error("audio codec decode aac sequence header failed, " | 499 | srs_error("audio codec decode aac sequence header failed, " |
500 | "adts object=%d invalid. ret=%d", profile_ObjectType, ret); | 500 | "adts object=%d invalid. ret=%d", profile_ObjectType, ret); |
@@ -472,7 +472,7 @@ public: | @@ -472,7 +472,7 @@ public: | ||
472 | * 1.5.1.1 Audio object type definition, page 23, | 472 | * 1.5.1.1 Audio object type definition, page 23, |
473 | * in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf. | 473 | * in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf. |
474 | */ | 474 | */ |
475 | - SrsAacProfile aac_profile; | 475 | + SrsAacObjectType aac_object; |
476 | /** | 476 | /** |
477 | * samplingFrequencyIndex | 477 | * samplingFrequencyIndex |
478 | */ | 478 | */ |
@@ -2797,7 +2797,8 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample) | @@ -2797,7 +2797,8 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample) | ||
2797 | int8_t number_of_raw_data_blocks_in_frame; //2bits, 0 indicating 1 raw_data_block() | 2797 | int8_t number_of_raw_data_blocks_in_frame; //2bits, 0 indicating 1 raw_data_block() |
2798 | */ | 2798 | */ |
2799 | // profile, 2bits | 2799 | // profile, 2bits |
2800 | - adts_header[2] = (codec->aac_profile << 6) & 0xc0; | 2800 | + SrsAacProfile aac_profile = srs_codec_aac_rtmp2ts(codec->aac_object); |
2801 | + adts_header[2] = (aac_profile << 6) & 0xc0; | ||
2801 | // sampling_frequency_index 4bits | 2802 | // sampling_frequency_index 4bits |
2802 | adts_header[2] |= (codec->aac_sample_rate << 2) & 0x3c; | 2803 | adts_header[2] |= (codec->aac_sample_rate << 2) & 0x3c; |
2803 | // channel_configuration 3bits | 2804 | // channel_configuration 3bits |
@@ -432,7 +432,7 @@ int SrsRawAacStream::adts_demux(SrsStream* stream, char** pframe, int* pnb_frame | @@ -432,7 +432,7 @@ int SrsRawAacStream::adts_demux(SrsStream* stream, char** pframe, int* pnb_frame | ||
432 | 432 | ||
433 | // the codec info. | 433 | // the codec info. |
434 | codec.protection_absent = protection_absent; | 434 | codec.protection_absent = protection_absent; |
435 | - codec.profile = (SrsAacProfile)profile; | 435 | + codec.aac_object = srs_codec_aac_ts2rtmp((SrsAacProfile)profile); |
436 | codec.sampling_frequency_index = sampling_frequency_index; | 436 | codec.sampling_frequency_index = sampling_frequency_index; |
437 | codec.channel_configuration = channel_configuration; | 437 | codec.channel_configuration = channel_configuration; |
438 | codec.frame_length = frame_length; | 438 | codec.frame_length = frame_length; |
@@ -471,11 +471,11 @@ int SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh | @@ -471,11 +471,11 @@ int SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh | ||
471 | int ret = ERROR_SUCCESS; | 471 | int ret = ERROR_SUCCESS; |
472 | 472 | ||
473 | // only support aac profile 1-4. | 473 | // only support aac profile 1-4. |
474 | - if (codec->profile == SrsAacProfileReserved) { | 474 | + if (codec->aac_object == SrsAacObjectTypeReserved) { |
475 | return ERROR_AAC_DATA_INVALID; | 475 | return ERROR_AAC_DATA_INVALID; |
476 | } | 476 | } |
477 | 477 | ||
478 | - SrsAacObjectType audioObjectType = srs_codec_aac_ts2rtmp(codec->profile); | 478 | + SrsAacObjectType audioObjectType = codec->aac_object; |
479 | char channelConfiguration = codec->channel_configuration; | 479 | char channelConfiguration = codec->channel_configuration; |
480 | char samplingFrequencyIndex = codec->sampling_frequency_index; | 480 | char samplingFrequencyIndex = codec->sampling_frequency_index; |
481 | 481 |
@@ -94,7 +94,7 @@ public: | @@ -94,7 +94,7 @@ public: | ||
94 | struct SrsRawAacStreamCodec | 94 | struct SrsRawAacStreamCodec |
95 | { | 95 | { |
96 | int8_t protection_absent; | 96 | int8_t protection_absent; |
97 | - SrsAacProfile profile; | 97 | + SrsAacObjectType aac_object; |
98 | int8_t sampling_frequency_index; | 98 | int8_t sampling_frequency_index; |
99 | int8_t channel_configuration; | 99 | int8_t channel_configuration; |
100 | int16_t frame_length; | 100 | int16_t frame_length; |
-
请 注册 或 登录 后发表评论