Page MenuHomeSolus

D9502.diff
No OneTemporary

D9502.diff

diff --git a/files/0002-stream-file-cache-file-size.patch b/files/0002-stream-file-cache-file-size.patch
new file mode 100644
--- /dev/null
+++ b/files/0002-stream-file-cache-file-size.patch
@@ -0,0 +1,73 @@
+From c59ca06a0fff432ac4cae012bb0299a8db9a00d3 Mon Sep 17 00:00:00 2001
+From: wm4 <wm4@nowhere>
+Date: Fri, 14 Feb 2020 16:07:13 +0100
+Subject: [PATCH] stream_file: cache file size
+
+Some cache logic in demux.c queries the raw byte stream size on every
+packet read. This is because it reports the value to the user. (It has
+to be polled like this because there is no change notification in most
+underlying I/O APIs, and also the user can't just block on the demuxer
+thread to update it explicitly.)
+
+This causes a very high number of get_size calls with low packet sizes,
+so cache the size, and update it on every read. Reads only happen
+approximately all 64KB read with default settings, which is way less
+frequent than every packet in such extreme cases.
+
+In theory, this could in theory cause problems in some cases. Actually
+this is whole commit complete non-sense, because why micro-optimize for
+broken cases like patent troll codecs. I don't need to justify it
+anyway.
+
+As a minor detail, off_t is actually specified as signed, so the off_t
+cast is never needed.
+---
+ stream/stream_file.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/stream/stream_file.c b/stream/stream_file.c
+index a79ef0e913..6e69f33c94 100644
+--- a/stream/stream_file.c
++++ b/stream/stream_file.c
+@@ -64,6 +64,7 @@ struct priv {
+ bool use_poll;
+ bool regular_file;
+ bool appending;
++ int64_t cached_size; // -2: invalid, -1: unknown
+ int64_t orig_size;
+ struct mp_cancel *cancel;
+ };
+@@ -75,15 +76,20 @@ struct priv {
+ static int64_t get_size(stream_t *s)
+ {
+ struct priv *p = s->priv;
+- off_t size = lseek(p->fd, 0, SEEK_END);
+- lseek(p->fd, s->pos, SEEK_SET);
+- return size == (off_t)-1 ? -1 : size;
++ if (p->cached_size == -2) {
++ off_t size = lseek(p->fd, 0, SEEK_END);
++ lseek(p->fd, s->pos, SEEK_SET);
++ p->cached_size = size < 0 ? -1 : size;
++ }
++ return p->cached_size;
+ }
+
+ static int fill_buffer(stream_t *s, void *buffer, int max_len)
+ {
+ struct priv *p = s->priv;
+
++ p->cached_size = -2; // always invalidate cached size
++
+ #ifndef __MINGW32__
+ if (p->use_poll) {
+ int c = mp_cancel_get_fd(p->cancel);
+@@ -245,7 +251,8 @@ static int open_f(stream_t *stream)
+ {
+ struct priv *p = talloc_ptrtype(stream, p);
+ *p = (struct priv) {
+- .fd = -1
++ .fd = -1,
++ .cached_size = -2,
+ };
+ stream->priv = p;
+ stream->is_local_file = true;
diff --git a/files/0003-stream-file-use-fstat-instead-of-lseek-to-determine-file-size.patch b/files/0003-stream-file-use-fstat-instead-of-lseek-to-determine-file-size.patch
new file mode 100644
--- /dev/null
+++ b/files/0003-stream-file-use-fstat-instead-of-lseek-to-determine-file-size.patch
@@ -0,0 +1,44 @@
+From 20eead18130fd460d8e9eff50ce14afd3646faab Mon Sep 17 00:00:00 2001
+From: wm4 <wm4@nowhere>
+Date: Sun, 16 Feb 2020 23:36:05 +0100
+Subject: [PATCH] stream_file: use fstat() instead of lseek() to determine file
+ size
+
+It appears using lseek() to seek to the end and back to determine file
+size is inefficient in some cases.
+
+With CIFS, this restores the performance regression that happened when
+the stream cache was removed (which called read() from a thread). This
+is probably faster than the old code too, because it's the seeking that
+was slowing down CIFS.
+
+According to the user who tested this, the size caching does not help
+with fstat() (although it did with the old method).
+
+Fixes: #7408, #7152
+---
+ stream/stream_file.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/stream/stream_file.c b/stream/stream_file.c
+index 6e69f33c94..9f83b73dd1 100644
+--- a/stream/stream_file.c
++++ b/stream/stream_file.c
+@@ -77,9 +77,14 @@ static int64_t get_size(stream_t *s)
+ {
+ struct priv *p = s->priv;
+ if (p->cached_size == -2) {
+- off_t size = lseek(p->fd, 0, SEEK_END);
+- lseek(p->fd, s->pos, SEEK_SET);
+- p->cached_size = size < 0 ? -1 : size;
++ int64_t size = -1;
++ struct stat st;
++ if (fstat(p->fd, &st) == 0) {
++ if (st.st_size <= 0 && !s->seekable)
++ st.st_size = -1;
++ size = st.st_size < 0 ? -1 : st.st_size;
++ }
++ p->cached_size = size;
+ }
+ return p->cached_size;
+ }
diff --git a/files/series b/files/series
new file mode 100644
--- /dev/null
+++ b/files/series
@@ -0,0 +1,3 @@
+0001-Support-a-stateless-configuration-on-nix-systems.patch
+0002-stream-file-cache-file-size.patch
+0003-stream-file-use-fstat-instead-of-lseek-to-determine-file-size.patch
\ No newline at end of file
diff --git a/package.yml b/package.yml
--- a/package.yml
+++ b/package.yml
@@ -1,7 +1,7 @@
name : mpv
homepage : https://mpv.io/
version : 0.32.0
-release : 76
+release : 77
source :
- https://github.com/mpv-player/mpv/archive/v0.32.0.tar.gz : 9163f64832226d22e24bbc4874ebd6ac02372cd717bef15c28a0aa858c5fe592
- https://waf.io/waf-2.0.19 : ba63c90a865a9bcf46926c4e6776f9a3f73d29f33d49b7f61f96bc37b7397cef
@@ -43,7 +43,9 @@
- python-docutils
- vulkan-headers
rundeps :
- - mpv-libs
+ - youtube-dl
+ - libs :
+ - youtube-dl
patterns :
- libs :
- /usr/lib64/lib*.so.*
@@ -56,7 +58,7 @@
environment: |
export CFLAGS="$CFLAGS -DNDEBUG"
setup : |
- %patch -p1 < $pkgfiles/0001-Support-a-stateless-configuration-on-nix-systems.patch
+ %apply_patches
install -m00755 $sources/waf-* ./waf
%waf_configure --confdir=/etc/mpv \
--libdir=%libdir% \
diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml
--- a/pspec_x86_64.xml
+++ b/pspec_x86_64.xml
@@ -3,8 +3,8 @@
<Name>mpv</Name>
<Homepage>https://mpv.io/</Homepage>
<Packager>
- <Name>Bryan T. Meyers</Name>
- <Email>bmeyers@datadrake.com</Email>
+ <Name>Alexander Vorobyev</Name>
+ <Email>avorobyev@protonmail.com</Email>
</Packager>
<License>GPL-2.0-or-later</License>
<License>LGPL-2.1-or-later</License>
@@ -22,9 +22,6 @@
While mpv has no official GUI, it has a small controller that is triggered by mouse movement. mpv leverages the FFmpeg hwaccel APIs to support VDPAU, VAAPI and VDA video decode acceleration.
</Description>
<PartOf>multimedia.video</PartOf>
- <RuntimeDependencies>
- <Dependency releaseFrom="76">mpv-libs</Dependency>
- </RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/bin/mpv</Path>
<Path fileType="data">/usr/share/applications/mpv.desktop</Path>
@@ -61,7 +58,7 @@
While mpv has no official GUI, it has a small controller that is triggered by mouse movement. mpv leverages the FFmpeg hwaccel APIs to support VDPAU, VAAPI and VDA video decode acceleration.
</Description>
<RuntimeDependencies>
- <Dependency release="76">mpv-libs</Dependency>
+ <Dependency release="77">mpv-libs</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include/mpv/client.h</Path>
@@ -78,12 +75,12 @@
</Replaces>
</Package>
<History>
- <Update release="76">
- <Date>2020-06-13</Date>
+ <Update release="77">
+ <Date>2020-08-25</Date>
<Version>0.32.0</Version>
<Comment>Packaging update</Comment>
- <Name>Bryan T. Meyers</Name>
- <Email>bmeyers@datadrake.com</Email>
+ <Name>Alexander Vorobyev</Name>
+ <Email>avorobyev@protonmail.com</Email>
</Update>
</History>
</PISI>
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Fri, Aug 11, 2:17 PM (3 h, 7 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5808215
Default Alt Text
D9502.diff (7 KB)

Event Timeline