mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the mix correct algorithm.
This commit is contained in:
parent
6fe36afcfa
commit
9743e02541
1 changed files with 21 additions and 8 deletions
|
@ -55,8 +55,8 @@ using namespace std;
|
||||||
// 115 packets is 3s.
|
// 115 packets is 3s.
|
||||||
#define SRS_PURE_AUDIO_GUESS_COUNT 115
|
#define SRS_PURE_AUDIO_GUESS_COUNT 115
|
||||||
|
|
||||||
// when got these videos or audios, mix ok.
|
// when got these videos or audios, pure audio or video, mix ok.
|
||||||
#define SRS_MIX_CORRECT_MIX_AV 10
|
#define SRS_MIX_CORRECT_PURE_AV 10
|
||||||
|
|
||||||
int _srs_time_jitter_string2int(std::string time_jitter)
|
int _srs_time_jitter_string2int(std::string time_jitter)
|
||||||
{
|
{
|
||||||
|
@ -849,12 +849,25 @@ void SrsMixQueue::push(SrsSharedPtrMessage* msg)
|
||||||
|
|
||||||
SrsSharedPtrMessage* SrsMixQueue::pop()
|
SrsSharedPtrMessage* SrsMixQueue::pop()
|
||||||
{
|
{
|
||||||
// when got 10+ videos or audios, mix ok.
|
bool mix_ok = false;
|
||||||
// when got 1 video and 1 audio, mix ok.
|
|
||||||
if (nb_videos < SRS_MIX_CORRECT_MIX_AV && nb_audios < SRS_MIX_CORRECT_MIX_AV) {
|
// pure video
|
||||||
if (nb_videos < 1 || nb_audios < 1) {
|
if (nb_videos >= SRS_MIX_CORRECT_PURE_AV && nb_audios == 0) {
|
||||||
return NULL;
|
mix_ok = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pure audio
|
||||||
|
if (nb_audios >= SRS_MIX_CORRECT_PURE_AV && nb_videos == 0) {
|
||||||
|
mix_ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// got 1 video and 1 audio, mix ok.
|
||||||
|
if (nb_videos >= 1 && nb_audios >= 1) {
|
||||||
|
mix_ok = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mix_ok) {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pop the first msg.
|
// pop the first msg.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue