From dbcd654e612ca32673cf2703758b05700cb87d03 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 19 May 2018 18:41:13 +0200 Subject: player: make playback termination asynchronous Until now, stopping playback aborted the demuxer and I/O layer violently by signaling mp_cancel (bound to libavformat's AVIOInterruptCB mechanism). Change it to try closing them gracefully. The main purpose is to silence those libavformat errors that happen when you request termination. Most of libavformat barely cares about the termination mechanism (AVIOInterruptCB), and essentially it's like the network connection is abruptly severed, or file I/O suddenly returns I/O errors. There were issues with dumb TLS warnings, parsers complaining about incomplete data, and some special protocols that require server communication to gracefully disconnect. We still want to abort it forcefully if it refuses to terminate on its own, so a timeout is required. Users can set the timeout to 0, which should give them the old behavior. This also removes the old mechanism that treats certain commands (like "quit") specially, and tries to terminate the demuxers even if the core is currently frozen. This is for situations where the core synchronized to the demuxer or stream layer while network is unresponsive. This in turn can only happen due to the "program" or "cache-size" properties in the current code (see one of the previous commits). Also, the old mechanism doesn't fit particularly well with the new one. We wouldn't want to abort playback immediately on a "quit" command - the new code is all about giving it a chance to end it gracefully. We'd need some sort of watchdog thread or something equally complicated to handle this. So just remove it. The change in osd.c is to prevent that it clears the status line while waiting for termination. The normal status line code doesn't output anything useful at this point, and the code path taken clears it, both of which is an annoying behavior change, so just let it show the old one. --- DOCS/interface-changes.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'DOCS/interface-changes.rst') diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index b2974eff12..177cc908fd 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -111,6 +111,17 @@ Interface changes as reference, which lists the definitive names. - edition and disc title switching will now fully reload playback (may have consequences for scripts, client API, or when using file-local options) + - remove async playback abort hack. This breaks aborting playback in the + following cases, iff the current stream is a network stream that + completely stopped responding: + - setting "program" property + - setting "cache-size" property + In earlier versions of mpv, the player core froze as well in these cases, + but could still be aborted with the quit, stop, playlist-prev, + playlist-next commands. If these properties are not accessed, frozen + network streams should not freeze the player core (only playback in + uncached regions), and differing behavior should be reported as a bug. + If --demuxer-thread=no is used, there are no guarantees. --- mpv 0.28.0 --- - rename --hwdec=mediacodec option to mediacodec-copy, to reflect conventions followed by other hardware video decoding APIs -- cgit v1.2.3