Skip to content

Commit

Permalink
Exit playback instead of pausing on Android suspend.
Browse files Browse the repository at this point in the history
Leaving playback paused sometimes leaves the frontend in a bad,
uncrecoverable state.  Unless and until that problem can be resolved,
simply exit playback when the frontend is suspended.
  • Loading branch information
gigem committed Jan 7, 2020
1 parent 1c97471 commit 627c03d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
21 changes: 2 additions & 19 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -13372,27 +13372,10 @@ void TV::onApplicationStateChange(Qt::ApplicationState state)
{
switch (state)
{
case Qt::ApplicationState::ApplicationActive:
{
LOG(VB_GENERAL, LOG_NOTICE, "Resuming playback");
PlayerContext *ctx = GetPlayerReadLock(-1, __FILE__, __LINE__);
SetBookmark(ctx, true);
DoSetPauseState(ctx, m_suspendedPause);
ReturnPlayerLock(ctx);
m_suspended = false;
break;
}
case Qt::ApplicationState::ApplicationSuspended:
{
LOG(VB_GENERAL, LOG_NOTICE, "Suspending playback");
m_suspended = true;
PlayerContext *ctx = GetPlayerReadLock(-1, __FILE__, __LINE__);
vector<bool> do_pause;
for (uint i = 0; i < m_player.size(); i++)
do_pause.push_back(true);
m_suspendedPause = DoSetPauseState(ctx, do_pause);
SetBookmark(ctx, false);
ReturnPlayerLock(ctx);
LOG(VB_GENERAL, LOG_NOTICE, "Exiting playback on app suspecnd");
StopPlayback();
break;
}
default:
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -931,8 +931,6 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer
bool m_isEmbedded {false}; ///< are we currently embedded
bool m_ignoreKeyPresses {false}; ///< should we ignore keypresses
vector<bool> m_savedPause; ///< saved pause state before embedding
bool m_suspended {false};///< are we currently suspended
vector<bool> m_suspendedPause; ///< saved pause state before suspending

// Channel group stuff
/// \brief Lock necessary when modifying channel group variables.
Expand Down

0 comments on commit 627c03d

Please sign in to comment.