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:43:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
921b7d239f29f23ed11c5853497543846945309a
921b7d23
1 parent
23a974b5
refine code, use macro for hls resample audio
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
14 行增加
和
7 行删除
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_config.hpp
查看文件 @
921b7d2
...
...
@@ -50,10 +50,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION
#define SRS_CONF_DEFAULT_DVR_DURATION 30
#define SRS_CONF_DEFAULT_TIME_JITTER "full"
// in ms, for HLS aac sync time.
#define SRS_CONF_DEFAULT_AAC_SYNC 100
// in ms, for HLS aac flush the audio
#define SRS_CONF_DEFAULT_AAC_DELAY 300
// in seconds, the live queue length.
#define SRS_CONF_DEFAULT_QUEUE_LENGTH 30
// in seconds, the paused queue length.
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
921b7d2
...
...
@@ -66,6 +66,16 @@ using namespace std;
// ts avc stream id.
#define TS_VIDEO_AVC 0xe0
// @see: ngx_rtmp_hls_audio
/* We assume here AAC frame size is 1024
* Need to handle AAC frames with frame size of 960 */
#define _SRS_AAC_SAMPLE_SIZE 1024
// in ms, for HLS aac sync time.
#define SRS_CONF_DEFAULT_AAC_SYNC 100
// in ms, for HLS aac flush the audio
#define SRS_CONF_DEFAULT_AAC_DELAY 300
// @see: ngx_rtmp_mpegts_header
u_int8_t
mpegts_header
[]
=
{
/* TS */
...
...
@@ -391,9 +401,10 @@ int64_t SrsHlsAacJitter::on_buffer_start(int64_t flv_pts, int sample_rate, int a
}
// @see: ngx_rtmp_hls_audio
/* TODO: We assume here AAC frame size is 1024
* Need to handle AAC frames with frame size of 960 */
int64_t
est_pts
=
base_pts
+
nb_samples
*
90000LL
*
1024LL
/
flv_sample_rate
;
// resample for the tbn of ts is 90000, flv is 1000,
// we will lost timestamp if use audio packet timestamp,
// so we must resample. or audio will corupt in IOS.
int64_t
est_pts
=
base_pts
+
nb_samples
*
90000LL
*
_SRS_AAC_SAMPLE_SIZE
/
flv_sample_rate
;
int64_t
dpts
=
(
int64_t
)
(
est_pts
-
flv_pts
);
if
(
dpts
<=
(
int64_t
)
sync_ms
*
90
&&
dpts
>=
(
int64_t
)
sync_ms
*
-
90
)
{
...
...
请
注册
或
登录
后发表评论