The audio stream is now only cleared from a single location in VideoFFmpegComponent.

Also made the video player finish processing if the video is paused.
This commit is contained in:
Leon Styhre 2021-05-19 19:52:58 +02:00
parent 9d8cb889ac
commit 65e119cff9
7 changed files with 2 additions and 12 deletions

View file

@ -44,7 +44,6 @@ bool MediaViewer::startMediaViewer(FileData* game)
if (mHasVideo) {
ViewController::get()->onPauseVideo();
AudioManager::getInstance()->clearStream();
}
if (mHasVideo || mHasImages)
@ -59,7 +58,6 @@ void MediaViewer::stopMediaViewer()
if (mVideo) {
ViewController::get()->onStopVideo();
AudioManager::getInstance()->clearStream();
delete mVideo;
mVideo = nullptr;
}
@ -191,7 +189,6 @@ void MediaViewer::showNext()
return;
}
else if (mVideo && !Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) {
AudioManager::getInstance()->clearStream();
delete mVideo;
mVideo = nullptr;
showedVideo = true;

View file

@ -235,8 +235,6 @@ void SystemScreensaver::stopScreensaver()
if (mGameOverlay)
mGameOverlay.reset();
AudioManager::getInstance()->clearStream();
}
void SystemScreensaver::nextGame() {

View file

@ -320,7 +320,6 @@ void ViewController::restoreViewPosition()
void ViewController::goToSystemView(SystemData* system, bool playTransition)
{
AudioManager::getInstance()->clearStream();
bool applicationStartup = false;
if (mState.viewing == NOTHING)
@ -818,7 +817,6 @@ bool ViewController::input(InputConfig* config, Input input)
mCurrentView->stopListScrolling();
// Finally, if the camera is currently moving, reset its position.
cancelViewTransitions();
AudioManager::getInstance()->clearStream();
mWindow->pushGui(new GuiMenu(mWindow));
return true;
@ -842,7 +840,6 @@ void ViewController::update(int deltaTime)
updateSelf(deltaTime);
if (mGameToLaunch) {
AudioManager::getInstance()->clearStream();
launch(mGameToLaunch);
mGameToLaunch = nullptr;
}

View file

@ -22,7 +22,6 @@ bool IGameListView::input(InputConfig* config, Input input)
config->isMappedTo("select", input) && input.value) {
ViewController::get()->cancelViewTransitions();
stopListScrolling();
AudioManager::getInstance()->clearStream();
mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem()));
return true;
}

View file

@ -395,7 +395,6 @@ void VideoGameListView::updateInfoPanel()
mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mVideo->setImage(file->getImagePath());
AudioManager::getInstance()->clearStream();
mVideo->onHide();

View file

@ -710,7 +710,6 @@ void Window::startScreensaver()
(*it)->onScreensaverActivate();
stopInfoPopup();
AudioManager::getInstance()->clearStream();
mScreensaver->startScreensaver(true);
mRenderScreensaver = true;
}

View file

@ -217,7 +217,7 @@ void VideoFFmpegComponent::update(int deltaTime)
void VideoFFmpegComponent::frameProcessing()
{
while (mIsPlaying) {
while (mIsPlaying && !mPause) {
readFrames();
if (!mEndOfVideo && mIsActuallyPlaying &&
@ -229,6 +229,7 @@ void VideoFFmpegComponent::frameProcessing()
// This 1 ms wait makes sure that the thread does not consume all available CPU cycles.
SDL_Delay(1);
}
AudioManager::getInstance()->clearStream();
}
void VideoFFmpegComponent::readFrames()