winlin

for bug #293, support aac stream.

@@ -145,7 +145,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -145,7 +145,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
145 } 145 }
146 146
147 // the left is the aac raw frame data. 147 // the left is the aac raw frame data.
148 - int16_t aac_frame_length = stream->size() - stream->pos(); 148 + int16_t aac_raw_length = stream->size() - stream->pos();
149 149
150 // write the ADTS header. 150 // write the ADTS header.
151 // @see aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 75, 151 // @see aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 75,
@@ -169,6 +169,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -169,6 +169,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
169 char aac_fixed_header[7]; 169 char aac_fixed_header[7];
170 if(true) { 170 if(true) {
171 char* pp = aac_fixed_header; 171 char* pp = aac_fixed_header;
  172 + int16_t aac_frame_length = aac_raw_length + 7;
172 173
173 // Syncword 12 bslbf 174 // Syncword 12 bslbf
174 *pp++ = 0xff; 175 *pp++ = 0xff;
@@ -212,7 +213,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -212,7 +213,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
212 } 213 }
213 214
214 // write aac frame body. 215 // write aac frame body.
215 - if ((ret = _fs->write(data + stream->pos(), aac_frame_length, NULL)) != ERROR_SUCCESS) { 216 + if ((ret = _fs->write(data + stream->pos(), aac_raw_length, NULL)) != ERROR_SUCCESS) {
216 return ret; 217 return ret;
217 } 218 }
218 219