[vlc-commits] chromecast: save header block directly from the write cb
Thomas Guillem
git at videolan.org
Wed Feb 7 23:45:46 CET 2018
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 7 14:10:42 2018 +0100| [221eb929b2d14b58f779f669e65d18b1478d80e6] | committer: Jean-Baptiste Kempf
chromecast: save header block directly from the write cb
This avoids to loose the header when flushing.
(cherry picked from commit 7a312f14051da7445eff66d820fc8ae286770185)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=221eb929b2d14b58f779f669e65d18b1478d80e6
---
modules/stream_out/chromecast/cast.cpp | 52 ++++++++++++++++------------------
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 87f0b1cf23..aa322c5b64 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -429,25 +429,13 @@ int sout_access_out_sys_t::url_cb(httpd_client_t *cl, httpd_message_t *answer,
vlc_fifo_Wait(m_fifo);
/* Handle block headers */
- if (p_block)
+ if (p_block && answer->i_body_offset == 0 && m_header != NULL)
{
- if (p_block->i_flags & BLOCK_FLAG_HEADER)
- {
- if (m_header)
- block_Release(m_header);
- m_header = p_block;
- }
- if (answer->i_body_offset == 0)
- {
- if (m_header != NULL && p_block != m_header)
- {
- /* Using header block. Re-insert current block into fifo */
- block_t *p_fifo = vlc_fifo_DequeueAllUnlocked(m_fifo);
- vlc_fifo_QueueUnlocked(m_fifo, p_block);
- vlc_fifo_QueueUnlocked(m_fifo, p_fifo);
- p_block = m_header;
- }
- }
+ /* Using header block. Re-insert current block into fifo */
+ block_t *p_fifo = vlc_fifo_DequeueAllUnlocked(m_fifo);
+ vlc_fifo_QueueUnlocked(m_fifo, p_block);
+ vlc_fifo_QueueUnlocked(m_fifo, p_fifo);
+ p_block = m_header;
}
bool do_unpace = vlc_fifo_GetBytes(m_fifo) < HTTPD_BUFFER_MAX;
vlc_fifo_Unlock(m_fifo);
@@ -510,17 +498,27 @@ static ssize_t AccessWrite(sout_access_out_t *p_access, block_t *p_block)
vlc_fifo_Lock(p_sys->m_fifo);
}
- /* Tell the demux filter to pace when the fifo starts to be full */
- bool do_pace = vlc_fifo_GetBytes(p_sys->m_fifo) >= HTTPD_BUFFER_MAX;
-
- /* Drop buffer is the fifo is really full */
- while (vlc_fifo_GetBytes(p_sys->m_fifo) >= (HTTPD_BUFFER_MAX * 2))
+ bool do_pace = false;
+ if (p_block->i_flags & BLOCK_FLAG_HEADER)
+ {
+ if (p_sys->m_header)
+ block_Release(p_sys->m_header);
+ p_sys->m_header = p_block;
+ }
+ else
{
- block_t *p_drop = vlc_fifo_DequeueUnlocked(p_sys->m_fifo);
- msg_Warn(p_access, "httpd buffer full: dropping %zuB", p_drop->i_buffer);
- block_Release(p_drop);
+ /* Tell the demux filter to pace when the fifo starts to be full */
+ do_pace = vlc_fifo_GetBytes(p_sys->m_fifo) >= HTTPD_BUFFER_MAX;
+
+ /* Drop buffer is the fifo is really full */
+ while (vlc_fifo_GetBytes(p_sys->m_fifo) >= (HTTPD_BUFFER_MAX * 2))
+ {
+ block_t *p_drop = vlc_fifo_DequeueUnlocked(p_sys->m_fifo);
+ msg_Warn(p_access, "httpd buffer full: dropping %zuB", p_drop->i_buffer);
+ block_Release(p_drop);
+ }
+ vlc_fifo_QueueUnlocked(p_sys->m_fifo, p_block);
}
- vlc_fifo_QueueUnlocked(p_sys->m_fifo, p_block);
vlc_fifo_Unlock(p_sys->m_fifo);
vlc_fifo_Signal(p_sys->m_fifo);
More information about the vlc-commits
mailing list