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
2014-07-05 23:29:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
63214d0f2b46ec754b404492d57716f86128706e
63214d0f
1 parent
7805f7b1
fix #81: support all aac sample rate, for instance, 48000. to 0.9.150
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
41 行增加
和
24 行删除
trunk/src/app/srs_app_avc_aac.cpp
trunk/src/app/srs_app_avc_aac.hpp
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_file.cpp
trunk/src/app/srs_app_avc_aac.cpp
查看文件 @
63214d0
...
...
@@ -108,7 +108,7 @@ SrsAvcAacCodec::SrsAvcAacCodec()
avc_profile
=
0
;
avc_level
=
0
;
aac_profile
=
0
;
aac_sample_rate
=
0
;
aac_sample_rate
=
_SRS_AAC_SAMPLE_RATE_UNSET
;
// sample rate ignored
aac_channels
=
0
;
avc_extra_size
=
0
;
avc_extra_data
=
NULL
;
...
...
@@ -166,25 +166,6 @@ int SrsAvcAacCodec::audio_aac_demux(int8_t* data, int size, SrsCodecSample* samp
sample
->
sound_rate
=
(
SrsCodecAudioSampleRate
)
sound_rate
;
sample
->
sound_size
=
(
SrsCodecAudioSampleSize
)
sound_size
;
// reset the sample rate by sequence header
static
int
aac_sample_rates
[]
=
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
};
switch
(
aac_sample_rates
[
aac_sample_rate
])
{
case
11025
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate11025
;
break
;
case
22050
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate22050
;
break
;
case
44100
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate44100
;
break
;
};
// only support aac
if
(
audio_codec_id
!=
SrsCodecAudioAAC
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
...
...
@@ -261,6 +242,27 @@ int SrsAvcAacCodec::audio_aac_demux(int8_t* data, int size, SrsCodecSample* samp
// ignored.
}
// reset the sample rate by sequence header
if
(
aac_sample_rate
!=
_SRS_AAC_SAMPLE_RATE_UNSET
)
{
static
int
aac_sample_rates
[]
=
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
};
switch
(
aac_sample_rates
[
aac_sample_rate
])
{
case
11025
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate11025
;
break
;
case
22050
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate22050
;
break
;
case
44100
:
sample
->
sound_rate
=
SrsCodecAudioSampleRate44100
;
break
;
};
}
srs_info
(
"audio decoded, type=%d, codec=%d, asize=%d, rate=%d, format=%d, size=%d"
,
sound_type
,
audio_codec_id
,
sound_size
,
sound_rate
,
sound_format
,
size
);
...
...
trunk/src/app/srs_app_avc_aac.hpp
查看文件 @
63214d0
...
...
@@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class
SrsStream
;
#define SRS_MAX_CODEC_SAMPLE 128
#define _SRS_AAC_SAMPLE_RATE_UNSET 15
// Sampling rate. The following values are defined:
// 0 = 5.5 kHz = 5512 Hz
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
63214d0
...
...
@@ -365,7 +365,7 @@ SrsHlsAacJitter::~SrsHlsAacJitter()
{
}
int64_t
SrsHlsAacJitter
::
on_buffer_start
(
int64_t
flv_pts
,
int
sample_rate
)
int64_t
SrsHlsAacJitter
::
on_buffer_start
(
int64_t
flv_pts
,
int
sample_rate
,
int
aac_sample_rate
)
{
// 0 = 5.5 kHz = 5512 Hz
// 1 = 11 kHz = 11025 Hz
...
...
@@ -374,6 +374,17 @@ int64_t SrsHlsAacJitter::on_buffer_start(int64_t flv_pts, int sample_rate)
static
int
flv_sample_rates
[]
=
{
5512
,
11025
,
22050
,
44100
};
int
flv_sample_rate
=
flv_sample_rates
[
sample_rate
&
0x03
];
// reset the sample rate by sequence header
if
(
aac_sample_rate
!=
_SRS_AAC_SAMPLE_RATE_UNSET
)
{
static
int
aac_sample_rates
[]
=
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
};
flv_sample_rate
=
aac_sample_rates
[
aac_sample_rate
];
}
// sync time set to 0, donot adjust the aac timestamp.
if
(
!
sync_ms
)
{
return
flv_pts
;
...
...
@@ -1016,7 +1027,7 @@ int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t
// start buffer, set the af
if
(
ab
->
size
==
0
)
{
pts
=
aac_jitter
->
on_buffer_start
(
pts
,
sample
->
sound_rate
);
pts
=
aac_jitter
->
on_buffer_start
(
pts
,
sample
->
sound_rate
,
codec
->
aac_sample_rate
);
af
->
dts
=
af
->
pts
=
audio_buffer_start_pts
=
pts
;
af
->
pid
=
TS_AUDIO_PID
;
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
63214d0
...
...
@@ -66,9 +66,11 @@ public:
/**
* when buffer start, calc the "correct" pts for ts,
* @param flv_pts, the flv pts calc from flv header timestamp,
* @param sample_rate, the sample rate in format(flv/RTMP packet header).
* @param aac_sample_rate, the sample rate in codec(sequence header).
* @return the calc correct pts.
*/
virtual
int64_t
on_buffer_start
(
int64_t
flv_pts
,
int
sample_rate
);
virtual
int64_t
on_buffer_start
(
int64_t
flv_pts
,
int
sample_rate
,
int
aac_sample_rate
);
/**
* when buffer continue, muxer donot write to file,
* the audio buffer continue grow and donot need a pts,
...
...
trunk/src/core/srs_core.hpp
查看文件 @
63214d0
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "1
49
"
#define VERSION_REVISION "1
50
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/kernel/srs_kernel_file.cpp
查看文件 @
63214d0
...
...
@@ -33,6 +33,7 @@ using namespace std;
SrsFileWriter
::
SrsFileWriter
()
{
fd
=
-
1
;
}
SrsFileWriter
::~
SrsFileWriter
()
...
...
请
注册
或
登录
后发表评论