Skip to content

Commit

Permalink
feat(mediaplayer): add maxAccurateSeekDelta option
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai authored and skufly committed Mar 18, 2020
1 parent 6fecf02 commit ec31796
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mediaPlayer/SuperMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ namespace Cicada {
return 0;
} else if (theKey == "enableVRC") {
mSet.bEnableVRC = (atoi(value) != 0);
} else if (theKey == "maxAccurateSeekDelta") {
mSet.maxASeekDelta = atoi(value) * 1000;
}

return 0;
Expand Down Expand Up @@ -2384,7 +2386,7 @@ namespace Cicada {
}

if (mSeekFlag && mSeekNeedCatch) {
if (pFrame->getInfo().timePosition < (mSeekPos - SEEK_ACCURATE_MAX)) {
if (pFrame->getInfo().timePosition < (mSeekPos - mSet.maxASeekDelta)) {
// first frame is far away from seek position, don't suppport accurate seek
mSeekNeedCatch = false;
}
Expand Down Expand Up @@ -3887,7 +3889,7 @@ namespace Cicada {
if (mSeekNeedCatch) {
int64_t videoPos = mBufferController.GetKeyTimePositionBefore(BUFFER_TYPE_VIDEO, mSeekPos);

if (videoPos < (mSeekPos - SEEK_ACCURATE_MAX)) {
if (videoPos < (mSeekPos - mSet.maxASeekDelta)) {
// first frame is far away from seek position, don't suppport accurate seek
mSeekNeedCatch = false;
} else {
Expand Down
1 change: 1 addition & 0 deletions mediaPlayer/player_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace Cicada {
mDefaultBandWidth = 0;
// Don't reset AnalyticsID
mOptions.reset();
maxASeekDelta = 21 * 1000 * 1000;
}
}

3 changes: 1 addition & 2 deletions mediaPlayer/player_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ namespace Cicada {
int64_t AnalyticsID = -1;
int mDefaultBandWidth = 0;
playerOptions mOptions;


bool bEnableVRC = false;
int maxASeekDelta = 21 * 1000 * 1000;
};
}

Expand Down

0 comments on commit ec31796

Please sign in to comment.