[vlc-commits] playlist: ignore uncork if paused upon cork
Rémi Denis-Courmont
git at videolan.org
Sun Jul 8 21:11:53 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 8 22:09:37 2018 +0300| [a195ecddbe18c7a51cbe7ecdec11afd6f589844a] | committer: Rémi Denis-Courmont
playlist: ignore uncork if paused upon cork
Only resume the playback automatically when the audio is uncorked,
if playback was actually active and got paused at time of corking.
This does not address all cases. If the user toggles with play/pause
while already corked, then it is unclear what should happen.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a195ecddbe18c7a51cbe7ecdec11afd6f589844a
---
src/playlist/engine.c | 18 ++++++++++++++----
src/playlist/playlist_internal.h | 1 +
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 10c4cf03e6..c5f9879a96 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -89,17 +89,27 @@ static int CorksCallback( vlc_object_t *obj, char const *var,
if( !var_InheritBool( obj, "playlist-cork" ) )
return VLC_SUCCESS;
+ playlist_Lock(pl);
+
if( cur.i_int )
{
- msg_Dbg( obj, "corked" );
- playlist_Pause( pl );
+ bool effective = playlist_Status(pl) == PLAYLIST_RUNNING;
+
+ msg_Dbg(obj, "corked (%seffective)", effective ? "" : "in");
+ pl_priv(pl)->cork_effective = effective;
+ playlist_Control(pl, PLAYLIST_PAUSE, pl_Locked);
}
else
{
- msg_Dbg( obj, "uncorked" );
- playlist_Resume( pl );
+ bool effective = pl_priv(pl)->cork_effective;
+
+ msg_Dbg(obj, "uncorked (%seffective)", effective ? "" : "in");
+
+ if (effective)
+ playlist_Control(pl, PLAYLIST_RESUME, pl_Locked);
}
+ playlist_Unlock(pl);
(void) var; (void) dummy;
return VLC_SUCCESS;
}
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 8112fcf067..659b86dab7 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -79,6 +79,7 @@ typedef struct playlist_private_t
vlc_mutex_t lock; /**< dah big playlist global lock */
vlc_cond_t signal; /**< wakes up the playlist engine thread */
bool killed; /**< playlist is shutting down */
+ bool cork_effective; /**< Corked while actively playing */
int i_last_playlist_id; /**< Last id to an item */
bool b_reset_currently_playing; /** Reset current item array */
More information about the vlc-commits
mailing list