Skip to content

Commit

Permalink
feat: add a event to notify video recover size too large
Browse files Browse the repository at this point in the history
fix #118

Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai authored and skufly committed Mar 18, 2020
1 parent e2806ab commit 8713fc5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions mediaPlayer/EventCodeMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ void EventCodeMap::init()
codeMap.insert(pair<int, int>(MEDIA_PLAYER_EVENT_DEMUXER_STARTUP_INFO, 112));
codeMap.insert(pair<int, int>(MEDIA_PLAYER_EVENT_NETWORK_RETRY_SUCCESS, 113));
codeMap.insert(pair<int, int>(MEDIA_PLAYER_EVENT_SUBTITLE_SELECT_ERROR, 114));
codeMap.insert(pair<int, int>(MEDIA_PLAYER_EVENT_DECODER_RECOVER_SIZE, 115));
}
12 changes: 12 additions & 0 deletions mediaPlayer/SuperMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <utils/file/FileUtils.h>
#include <data_source/dataSourcePrototype.h>
#include <demuxer/IDemuxer.h>
#include <utils/af_string.h>


#ifdef __APPLE__
Expand Down Expand Up @@ -559,6 +560,8 @@ namespace Cicada {
mSet.bEnableVRC = (atoi(value) != 0);
} else if (theKey == "maxAccurateSeekDelta") {
mSet.maxASeekDelta = atoi(value) * 1000;
} else if (theKey == "maxVideoRecoverSize") {
mSet.maxVideoRecoverSize = atoi(value);
}

return 0;
Expand Down Expand Up @@ -4048,6 +4051,15 @@ namespace Cicada {
{
if (mVideoDecoder) {
mVideoDecoder->holdOn(hold);

if (!hold) {
int size = mVideoDecoder->getRecoverQueueSize();

if (size > mSet.maxVideoRecoverSize) {
string des = "video decoder recover size too large:" + AfString::to_string(size);
mPNotifier->NotifyEvent(MEDIA_PLAYER_EVENT_DECODER_RECOVER_SIZE, des.c_str());
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions mediaPlayer/media_player_error_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace Cicada{
MEDIA_PLAYER_EVENT_DEMUXER_STARTUP_INFO,

MEDIA_PLAYER_EVENT_SUBTITLE_SELECT_ERROR,
MEDIA_PLAYER_EVENT_DECODER_RECOVER_SIZE,
};
}

Expand Down
1 change: 1 addition & 0 deletions mediaPlayer/player_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace Cicada {
// Don't reset AnalyticsID
mOptions.reset();
maxASeekDelta = 21 * 1000 * 1000;
maxVideoRecoverSize = 300;
}
}

4 changes: 3 additions & 1 deletion mediaPlayer/player_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ namespace Cicada {
int mDefaultBandWidth = 0;
playerOptions mOptions;
bool bEnableVRC = false;
int maxASeekDelta = 21 * 1000 * 1000;
int maxASeekDelta = 21 * 1000 * 1000;//us

int maxVideoRecoverSize;
};
}

Expand Down

0 comments on commit 8713fc5

Please sign in to comment.