Skip to content

Commit

Permalink
Merge pull request #12647 from shenweip/psmf
Browse files Browse the repository at this point in the history
Check whether the audio is actually played in psmf player
  • Loading branch information
hrydgard authored Feb 29, 2020
2 parents 1460d94 + 41a53d7 commit 558a101
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/HLE/scePsmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class PsmfPlayer {

bool HasReachedEnd() {
// The pts are ignored - the end is when we're out of data.
return mediaengine->IsVideoEnd() && mediaengine->IsNoAudioData();
return mediaengine->IsVideoEnd() && (mediaengine->IsNoAudioData() || !mediaengine->IsActuallyPlayingAudio());
}

u32 filehandle;
Expand Down Expand Up @@ -1617,7 +1617,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
bool doVideoStep = true;
if (psmfplayer->playMode == PSMF_PLAYER_MODE_PAUSE) {
doVideoStep = false;
} else if (!psmfplayer->mediaengine->IsNoAudioData()) {
} else if (!psmfplayer->mediaengine->IsNoAudioData() && psmfplayer->mediaengine->IsActuallyPlayingAudio()) {
s64 deltapts = psmfplayer->mediaengine->getVideoTimeStamp() - psmfplayer->mediaengine->getAudioTimeStamp();
// Don't skip the very first frame, sometimes audio starts with an early timestamp.
if (deltapts > 0 && psmfplayer->mediaengine->getVideoTimeStamp() > 0) {
Expand Down
4 changes: 4 additions & 0 deletions Core/HW/MediaEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,10 @@ bool MediaEngine::IsNoAudioData() {
return !m_demux->hasNextAudioFrame(NULL, NULL, NULL, NULL);
}

bool MediaEngine::IsActuallyPlayingAudio() {
return getAudioTimeStamp() >= 0;
}

s64 MediaEngine::getVideoTimeStamp() {
return m_videopts;
}
Expand Down
1 change: 1 addition & 0 deletions Core/HW/MediaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class MediaEngine

bool IsVideoEnd() { return m_isVideoEnd; }
bool IsNoAudioData();
bool IsActuallyPlayingAudio();
int VideoWidth() { return m_desWidth; }
int VideoHeight() { return m_desHeight; }

Expand Down

0 comments on commit 558a101

Please sign in to comment.