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

for #310, refine the aac profile for adts and aac object for RTMP sequence header.

This commit is contained in:
winlin 2015-03-08 17:33:52 +08:00
parent 04f3f2a8f8
commit d3e2838fc6
10 changed files with 141 additions and 130 deletions

View file

@ -2764,20 +2764,6 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample)
srs_error("invalid aac frame length=%d, ret=%d", size, ret);
return ret;
}
// the profile = object_id + 1
// @see aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 78,
// Table 1. A.9 ¨C MPEG-2 Audio profiles and MPEG-4 Audio object types
// the valid object type:
// AAC Main(ID == 0)
// AAC LC(ID == 1)
// AAC SSR(ID == 2)
// AAC LTP(ID == 3)
u_int8_t profile_ObjectType = codec->aac_profile - 1;
// TODO: FIXME: only support Main or LC.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/310
profile_ObjectType = srs_min(1, profile_ObjectType);
// the frame length is the AAC raw data plus the adts header size.
int32_t frame_length = size + 7;
@ -2811,7 +2797,7 @@ int SrsTsCache::do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample)
int8_t number_of_raw_data_blocks_in_frame; //2bits, 0 indicating 1 raw_data_block()
*/
// profile, 2bits
adts_header[2] = (profile_ObjectType << 6) & 0xc0;
adts_header[2] = (codec->aac_profile << 6) & 0xc0;
// sampling_frequency_index 4bits
adts_header[2] |= (codec->aac_sample_rate << 2) & 0x3c;
// channel_configuration 3bits