[vlc-commits] chromecast: drop buffers when flushed more than one time in a row

Thomas Guillem git at videolan.org
Wed Feb 7 23:45:48 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  7 14:25:48 2018 +0100| [013223e87a9125f82df536861a4af62ff73c26c0] | committer: Jean-Baptiste Kempf

chromecast: drop buffers when flushed more than one time in a row

(cherry picked from commit 64ecd0ae1eaf67aff21a82ef1ad4795637db6e3f)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=013223e87a9125f82df536861a4af62ff73c26c0
---

 modules/stream_out/chromecast/cast.cpp | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 8da2170a28..b52796d4d4 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -419,14 +419,24 @@ int sout_access_out_sys_t::url_cb(httpd_client_t *cl, httpd_message_t *answer,
     vlc_fifo_Lock(m_fifo);
 
     block_t *p_block = NULL;
-    while ((p_block = vlc_fifo_DequeueUnlocked(m_fifo)) == NULL
-       && !m_eof)
-        vlc_fifo_Wait(m_fifo);
+    do
+    {
+        while ((p_block = vlc_fifo_DequeueUnlocked(m_fifo)) == NULL
+           && !m_eof)
+            vlc_fifo_Wait(m_fifo);
+
+        /* Wait for the seek to be done. This will prevent the CC to flush this
+         * buffer that came after a flush. */
+        while (m_seeking && !m_eof)
+            vlc_fifo_Wait(m_fifo);
+
+        if (m_flushing && p_block)
+        {
+            block_Release(p_block);
+            p_block = NULL;
+        }
 
-    /* Wait for the seek to be done. This will prevent the CC to flush this
-     * buffer that came after a flush. */
-    while (m_seeking && !m_eof)
-        vlc_fifo_Wait(m_fifo);
+    } while (m_flushing);
 
     /* Handle block headers */
     if (p_block && answer->i_body_offset == 0 && m_header != NULL)
@@ -571,6 +581,7 @@ static void AccessClose(vlc_object_t *p_this)
 
     vlc_fifo_Lock(p_sys->m_fifo);
     p_sys->m_eof = true;
+    p_sys->m_flushing = false;
     vlc_fifo_Unlock(p_sys->m_fifo);
     vlc_fifo_Signal(p_sys->m_fifo);
 



More information about the vlc-commits mailing list