Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-03-08 17:56:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
885b9af122cb9f2fb1ec57787f73bae73c9e9a50
885b9af1
1 parent
8dbabe37
for #310, refine code to support he/hev2, use aac object.
隐藏空白字符变更
内嵌
并排对比
正在显示
10 个修改的文件
包含
23 行增加
和
21 行删除
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/app/srs_app_statistic.hpp
trunk/src/kernel/srs_kernel_aac.cpp
trunk/src/kernel/srs_kernel_aac.hpp
trunk/src/kernel/srs_kernel_codec.cpp
trunk/src/kernel/srs_kernel_codec.hpp
trunk/src/kernel/srs_kernel_ts.cpp
trunk/src/protocol/srs_raw_avc.cpp
trunk/src/protocol/srs_raw_avc.hpp
trunk/src/app/srs_app_source.cpp
查看文件 @
885b9af
...
...
@@ -1397,15 +1397,15 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
// when got audio stream info.
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
if
((
ret
=
stat
->
on_audio_info
(
_req
,
SrsCodecAudioAAC
,
sample
.
sound_rate
,
sample
.
sound_type
,
codec
.
aac_
profile
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
stat
->
on_audio_info
(
_req
,
SrsCodecAudioAAC
,
sample
.
sound_rate
,
sample
.
sound_type
,
codec
.
aac_
object
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_trace
(
"%dB audio sh, "
"codec(%d, profile=%
d
, %dchannels, %dkbps, %dHZ), "
"codec(%d, profile=%
s
, %dchannels, %dkbps, %dHZ), "
"flv(%dbits, %dchannels, %dHZ)"
,
msg
.
size
,
codec
.
audio_codec_id
,
codec
.
aac_profile
,
codec
.
aac_channels
,
srs_codec_aac_object2str
(
codec
.
aac_object
).
c_str
()
,
codec
.
aac_channels
,
codec
.
audio_data_rate
/
1000
,
aac_sample_rates
[
codec
.
aac_sample_rate
],
flv_sample_sizes
[
sample
.
sound_size
],
flv_sound_types
[
sample
.
sound_type
],
flv_sample_rates
[
sample
.
sound_rate
]);
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
885b9af
...
...
@@ -60,7 +60,7 @@ SrsStatisticStream::SrsStatisticStream()
acodec
=
SrsCodecAudioReserved1
;
asample_rate
=
SrsCodecAudioSampleRateReserved
;
asound_type
=
SrsCodecAudioSoundTypeReserved
;
aac_
profile
=
SrsAacProfil
eReserved
;
aac_
object
=
SrsAacObjectTyp
eReserved
;
}
SrsStatisticStream
::~
SrsStatisticStream
()
...
...
@@ -128,7 +128,7 @@ int SrsStatistic::on_video_info(SrsRequest* req,
int
SrsStatistic
::
on_audio_info
(
SrsRequest
*
req
,
SrsCodecAudio
acodec
,
SrsCodecAudioSampleRate
asample_rate
,
SrsCodecAudioSoundType
asound_type
,
SrsAac
Profile
aac_profile
SrsAac
ObjectType
aac_object
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -139,7 +139,7 @@ int SrsStatistic::on_audio_info(SrsRequest* req,
stream
->
acodec
=
acodec
;
stream
->
asample_rate
=
asample_rate
;
stream
->
asound_type
=
asound_type
;
stream
->
aac_
profile
=
aac_profile
;
stream
->
aac_
object
=
aac_object
;
return
ret
;
}
...
...
@@ -257,7 +257,7 @@ int SrsStatistic::dumps_streams(stringstream& ss)
<<
__SRS_JFIELD_STR
(
"codec"
,
srs_codec_audio2str
(
stream
->
acodec
))
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"sample_rate"
,
(
int
)
flv_sample_rates
[
stream
->
asample_rate
])
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"channel"
,
(
int
)
stream
->
asound_type
+
1
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_STR
(
"profile"
,
srs_codec_aac_
profile2str
(
stream
->
aac_profile
))
<<
__SRS_JFIELD_STR
(
"profile"
,
srs_codec_aac_
object2str
(
stream
->
aac_object
))
<<
__SRS_JOBJECT_END
;
}
...
...
trunk/src/app/srs_app_statistic.hpp
查看文件 @
885b9af
...
...
@@ -73,7 +73,7 @@ public:
* 1.5.1.1 Audio object type definition, page 23,
* in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf.
*/
SrsAac
Profile
aac_profile
;
SrsAac
ObjectType
aac_object
;
public
:
SrsStatisticStream
();
virtual
~
SrsStatisticStream
();
...
...
@@ -120,7 +120,7 @@ public:
*/
virtual
int
on_audio_info
(
SrsRequest
*
req
,
SrsCodecAudio
acodec
,
SrsCodecAudioSampleRate
asample_rate
,
SrsCodecAudioSoundType
asound_type
,
SrsAac
Profile
aac_profile
SrsAac
ObjectType
aac_object
);
/**
* when close stream.
...
...
trunk/src/kernel/srs_kernel_aac.cpp
查看文件 @
885b9af
...
...
@@ -43,7 +43,7 @@ SrsAacEncoder::SrsAacEncoder()
_fs
=
NULL
;
got_sequence_header
=
false
;
tag_stream
=
new
SrsStream
();
aac_
profile
=
SrsAacProfil
eReserved
;
aac_
object
=
SrsAacObjectTyp
eReserved
;
}
SrsAacEncoder
::~
SrsAacEncoder
()
...
...
@@ -131,7 +131,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
aac_sample_rate
=
((
audioObjectType
<<
1
)
&
0x0e
)
|
((
aac_sample_rate
>>
7
)
&
0x01
);
audioObjectType
=
(
audioObjectType
>>
3
)
&
0x1f
;
aac_
profile
=
srs_codec_aac_rtmp2ts
((
SrsAacObjectType
)
audioObjectType
)
;
aac_
object
=
(
SrsAacObjectType
)
audioObjectType
;
got_sequence_header
=
true
;
...
...
@@ -186,6 +186,7 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
// channel_configuration 3 uimsbf
// original/copy 1 bslbf
// home 1 bslbf
SrsAacProfile
aac_profile
=
srs_codec_aac_rtmp2ts
(
aac_object
);
*
pp
++
=
((
aac_profile
<<
6
)
&
0xc0
)
|
((
aac_sample_rate
<<
2
)
&
0x3c
)
|
((
aac_channels
>>
2
)
&
0x01
);
// 4bits left.
// adts_variable_header(), 1.A.2.2.2 Variable Header of ADTS
...
...
trunk/src/kernel/srs_kernel_aac.hpp
查看文件 @
885b9af
...
...
@@ -45,7 +45,7 @@ class SrsAacEncoder
private
:
SrsFileWriter
*
_fs
;
private
:
SrsAac
Profile
aac_profile
;
SrsAac
ObjectType
aac_object
;
int8_t
aac_sample_rate
;
int8_t
aac_channels
;
bool
got_sequence_header
;
...
...
trunk/src/kernel/srs_kernel_codec.cpp
查看文件 @
885b9af
...
...
@@ -294,7 +294,7 @@ SrsAvcAacCodec::SrsAvcAacCodec()
avc_profile
=
0
;
avc_level
=
0
;
aac_
profile
=
SrsAacProfil
eReserved
;
aac_
object
=
SrsAacObjectTyp
eReserved
;
aac_sample_rate
=
__SRS_AAC_SAMPLE_RATE_UNSET
;
// sample rate ignored
aac_channels
=
0
;
avc_extra_size
=
0
;
...
...
@@ -493,8 +493,8 @@ int SrsAvcAacCodec::audio_aac_sequence_header_demux(char* data, int size)
aac_sample_rate
=
samplingFrequencyIndex
;
// convert the object type in sequence header to aac profile of ADTS.
aac_profile
=
srs_codec_aac_rtmp2ts
((
SrsAacObjectType
)
profile_ObjectType
);
if
(
aac_profile
==
SrsAacProfileReserved
)
{
aac_object
=
(
SrsAacObjectType
)
profile_ObjectType
;
if
(
aac_object
==
SrsAacObjectTypeReserved
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"audio codec decode aac sequence header failed, "
"adts object=%d invalid. ret=%d"
,
profile_ObjectType
,
ret
);
...
...
trunk/src/kernel/srs_kernel_codec.hpp
查看文件 @
885b9af
...
...
@@ -472,7 +472,7 @@ public:
* 1.5.1.1 Audio object type definition, page 23,
* in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf.
*/
SrsAac
Profile
aac_profile
;
SrsAac
ObjectType
aac_object
;
/**
* samplingFrequencyIndex
*/
...
...
trunk/src/kernel/srs_kernel_ts.cpp
查看文件 @
885b9af
...
...
@@ -2797,7 +2797,8 @@ 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
]
=
(
codec
->
aac_profile
<<
6
)
&
0xc0
;
SrsAacProfile
aac_profile
=
srs_codec_aac_rtmp2ts
(
codec
->
aac_object
);
adts_header
[
2
]
=
(
aac_profile
<<
6
)
&
0xc0
;
// sampling_frequency_index 4bits
adts_header
[
2
]
|=
(
codec
->
aac_sample_rate
<<
2
)
&
0x3c
;
// channel_configuration 3bits
...
...
trunk/src/protocol/srs_raw_avc.cpp
查看文件 @
885b9af
...
...
@@ -432,7 +432,7 @@ int SrsRawAacStream::adts_demux(SrsStream* stream, char** pframe, int* pnb_frame
// the codec info.
codec
.
protection_absent
=
protection_absent
;
codec
.
profile
=
(
SrsAacProfile
)
profile
;
codec
.
aac_object
=
srs_codec_aac_ts2rtmp
((
SrsAacProfile
)
profile
)
;
codec
.
sampling_frequency_index
=
sampling_frequency_index
;
codec
.
channel_configuration
=
channel_configuration
;
codec
.
frame_length
=
frame_length
;
...
...
@@ -471,11 +471,11 @@ int SrsRawAacStream::mux_sequence_header(SrsRawAacStreamCodec* codec, string& sh
int
ret
=
ERROR_SUCCESS
;
// only support aac profile 1-4.
if
(
codec
->
profile
==
SrsAacProfil
eReserved
)
{
if
(
codec
->
aac_object
==
SrsAacObjectTyp
eReserved
)
{
return
ERROR_AAC_DATA_INVALID
;
}
SrsAacObjectType
audioObjectType
=
srs_codec_aac_ts2rtmp
(
codec
->
profile
)
;
SrsAacObjectType
audioObjectType
=
codec
->
aac_object
;
char
channelConfiguration
=
codec
->
channel_configuration
;
char
samplingFrequencyIndex
=
codec
->
sampling_frequency_index
;
...
...
trunk/src/protocol/srs_raw_avc.hpp
查看文件 @
885b9af
...
...
@@ -94,7 +94,7 @@ public:
struct
SrsRawAacStreamCodec
{
int8_t
protection_absent
;
SrsAac
Profile
profile
;
SrsAac
ObjectType
aac_object
;
int8_t
sampling_frequency_index
;
int8_t
channel_configuration
;
int16_t
frame_length
;
...
...
请
注册
或
登录
后发表评论