[vlc-commits] playlist: ignore uncork if paused upon cork
Rémi Denis-Courmont
git at videolan.org
Tue Aug 21 10:03:55 CEST 2018
vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 8 22:09:37 2018 +0300| [1b4b3178696b0ab493ca7a198078175f84a9640e] | committer: Jean-Baptiste Kempf
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.
(cherry picked from commit a195ecddbe18c7a51cbe7ecdec11afd6f589844a)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1b4b3178696b0ab493ca7a198078175f84a9640e
---
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 7302a2ef1b..ede6c9b3ce 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 ae48c75e87..9537a5f270 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -83,6 +83,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