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-06-06 21:54:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2d9f258eaf187ce71aee1c474f898d4f31f6372c
2d9f258e
1 parent
ec245339
refine the mix correct algorithm, mix when got 10+ av or got 1 video and 1 audio.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
15 行增加
和
2 行删除
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_source.hpp
trunk/src/app/srs_app_source.cpp
查看文件 @
2d9f258
...
...
@@ -54,6 +54,9 @@ using namespace std;
// 115 packets is 3s.
#define SRS_PURE_AUDIO_GUESS_COUNT 115
// when got these videos or audios, mix ok.
#define SRS_MIX_CORRECT_MIX_AV 10
int
_srs_time_jitter_string2int
(
std
::
string
time_jitter
)
{
if
(
time_jitter
==
"full"
)
{
...
...
@@ -810,6 +813,7 @@ void SrsSource::destroy()
SrsMixQueue
::
SrsMixQueue
()
{
nb_videos
=
0
;
nb_audios
=
0
;
}
SrsMixQueue
::~
SrsMixQueue
()
...
...
@@ -827,6 +831,7 @@ void SrsMixQueue::clear()
msgs
.
clear
();
nb_videos
=
0
;
nb_audios
=
0
;
}
void
SrsMixQueue
::
push
(
SrsSharedPtrMessage
*
msg
)
...
...
@@ -835,15 +840,20 @@ void SrsMixQueue::push(SrsSharedPtrMessage* msg)
if
(
msg
->
is_video
())
{
nb_videos
++
;
}
else
{
nb_audios
++
;
}
}
SrsSharedPtrMessage
*
SrsMixQueue
::
pop
()
{
// always keep 2+ videos
if
(
nb_videos
<
2
)
{
// when got 10+ videos or audios, mix ok.
// when got 1 video and 1 audio, mix ok.
if
(
nb_videos
<
SRS_MIX_CORRECT_MIX_AV
&&
nb_audios
<
SRS_MIX_CORRECT_MIX_AV
)
{
if
(
nb_videos
<
1
||
nb_audios
<
1
)
{
return
NULL
;
}
}
// pop the first msg.
std
::
multimap
<
int64_t
,
SrsSharedPtrMessage
*>::
iterator
it
=
msgs
.
begin
();
...
...
@@ -852,6 +862,8 @@ SrsSharedPtrMessage* SrsMixQueue::pop()
if
(
msg
->
is_video
())
{
nb_videos
--
;
}
else
{
nb_audios
--
;
}
return
msg
;
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
2d9f258
...
...
@@ -375,6 +375,7 @@ class SrsMixQueue
{
private
:
u_int32_t
nb_videos
;
u_int32_t
nb_audios
;
std
::
multimap
<
int64_t
,
SrsSharedPtrMessage
*>
msgs
;
public
:
SrsMixQueue
();
...
...
请
注册
或
登录
后发表评论