playsink: release all chains when going to NULL
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Wed, 23 Feb 2011 13:31:13 +0000 (14:31 +0100)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Wed, 23 Feb 2011 13:33:40 +0000 (14:33 +0100)
Also fixes #642466.

gst/playback/gstplaysink.c

index 14d6882178d5a955c4841ddb5c4c5b94afe84cba..5ba637ac40413abff3482532c7b6b699857b6d8f 100644 (file)
@@ -3271,6 +3271,21 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
         add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
       }
       do_async_done (playsink);
+      /* when going to READY, keep elements around as long as possible,
+       * so they may be re-used faster next time/url around.
+       * when really going to NULL, clean up everything completely. */
+      if (transition == GST_STATE_CHANGE_READY_TO_NULL) {
+        free_chain ((GstPlayChain *) playsink->videodeinterlacechain);
+        playsink->videodeinterlacechain = NULL;
+        free_chain ((GstPlayChain *) playsink->videochain);
+        playsink->videochain = NULL;
+        free_chain ((GstPlayChain *) playsink->audiochain);
+        playsink->audiochain = NULL;
+        free_chain ((GstPlayChain *) playsink->vischain);
+        playsink->vischain = NULL;
+        free_chain ((GstPlayChain *) playsink->textchain);
+        playsink->textchain = NULL;
+      }
       break;
     default:
       break;