mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-14 20:02:38 +00:00
pinossink: clear the cache
Now that we don't destroy the cache anymore when suspending, we need to manually clear the buffers in the cache.
This commit is contained in:
parent
5c7447fb4d
commit
76afc1e330
|
@ -174,6 +174,7 @@ gst_burst_cache_init (GstBurstCache * this)
|
|||
this->recover = DEFAULT_RECOVER;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_burst_cache_finalize (GObject * object)
|
||||
{
|
||||
|
@ -1061,17 +1062,17 @@ remove_hook (GstBurstCacheReader * reader, GstBurstCache * cache)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_burst_cache_clear_readers:
|
||||
* gst_burst_cache_remove_readers:
|
||||
* @cache: a #GstBurstCache
|
||||
*
|
||||
* Remove all readers from @cache.
|
||||
*/
|
||||
void
|
||||
gst_burst_cache_clear_readers (GstBurstCache * cache)
|
||||
gst_burst_cache_remove_readers (GstBurstCache * cache)
|
||||
{
|
||||
g_return_if_fail (GST_IS_BURST_CACHE (cache));
|
||||
|
||||
GST_DEBUG_OBJECT (cache, "clearing all readers");
|
||||
GST_DEBUG_OBJECT (cache, "removing all readers");
|
||||
|
||||
CACHE_LOCK (cache);
|
||||
g_hook_list_marshal_check (&cache->readers, TRUE, (GHookCheckMarshaller)
|
||||
|
@ -1337,6 +1338,23 @@ gst_burst_cache_queue_buffer (GstBurstCache * cache, GstBuffer * buffer)
|
|||
CACHE_UNLOCK (cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_burst_cache_remove_buffers:
|
||||
* @cache: a #GstBurstCache
|
||||
*
|
||||
* Remove all buffers from @cache.
|
||||
*/
|
||||
void
|
||||
gst_burst_cache_remove_buffers (GstBurstCache * cache)
|
||||
{
|
||||
g_return_if_fail (GST_IS_BURST_CACHE (cache));
|
||||
|
||||
CACHE_LOCK (cache);
|
||||
g_ptr_array_foreach (cache->bufqueue, (GFunc) gst_buffer_unref, NULL);
|
||||
g_ptr_array_set_size (cache->bufqueue, 0);
|
||||
CACHE_UNLOCK (cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_burst_cache_get_buffer:
|
||||
* @cache: a #GstBurstCache
|
||||
|
|
|
@ -272,6 +272,7 @@ void gst_burst_cache_get_limits (GstBurstCache *cache,
|
|||
|
||||
void gst_burst_cache_queue_buffer (GstBurstCache *cache,
|
||||
GstBuffer *buffer);
|
||||
void gst_burst_cache_remove_buffers (GstBurstCache *cache);
|
||||
|
||||
GstBurstCacheReader * gst_burst_cache_reader_new (GstBurstCache *cache,
|
||||
GstBurstCacheReaderCallback callback,
|
||||
|
@ -292,7 +293,7 @@ gboolean gst_burst_cache_error_reader (GstBurstCache *cache,
|
|||
GstBurstCacheReader *reader,
|
||||
GError *error);
|
||||
|
||||
void gst_burst_cache_clear_readers (GstBurstCache * cache);
|
||||
void gst_burst_cache_remove_readers (GstBurstCache * cache);
|
||||
|
||||
|
||||
GstBurstCacheResult gst_burst_cache_get_buffer (GstBurstCache *cache,
|
||||
|
|
|
@ -444,6 +444,8 @@ thread_error:
|
|||
static gboolean
|
||||
gst_pinos_socket_sink_close (GstPinosSocketSink * this)
|
||||
{
|
||||
gst_burst_cache_remove_buffers (this->cache);
|
||||
|
||||
GST_DEBUG ("context %p, loop %p", this->context, this->loop);
|
||||
g_main_loop_quit (this->loop);
|
||||
g_thread_join (this->thread);
|
||||
|
|
Loading…
Reference in a new issue