[vlc-commits] stream_extractor: enable cache for block based extractors

Filip Roséen git at videolan.org
Wed Sep 20 16:57:02 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Feb  2 17:57:08 2017 +0100| [6c643e6f18f93d79f7ff0f6f294d89f18e182fbb] | committer: Thomas Guillem

stream_extractor: enable cache for block based extractors

In order to extract an entity from a stream, some heavy lifting is normally
required, as such it makes sense to cache data coming out from a
stream_extractor in order to save CPU (and more importantly battery life on
mobile devices).

This will especially make a big impact when block-based stream_extractors are
used, since they will not be asked to potentially regenerate the same block
data over and over.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c643e6f18f93d79f7ff0f6f294d89f18e182fbb
---

 src/input/stream_extractor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/input/stream_extractor.c b/src/input/stream_extractor.c
index 05ffa4668e..e32d73e968 100644
--- a/src/input/stream_extractor.c
+++ b/src/input/stream_extractor.c
@@ -272,6 +272,11 @@ se_AttachWrapper( struct stream_extractor_private* priv, stream_t* source )
 
     priv->source = source;
 
+    if( priv->wrapper->pf_read )
+        priv->wrapper = stream_FilterChainNew( priv->wrapper, "cache_read" );
+    else if( priv->wrapper->pf_block )
+        priv->wrapper = stream_FilterChainNew( priv->wrapper, "cache_block" );
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list