summaryrefslogtreecommitdiffstats
path: root/media/libcubeb/unresampled-frames.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /media/libcubeb/unresampled-frames.patch
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/libcubeb/unresampled-frames.patch')
-rw-r--r--media/libcubeb/unresampled-frames.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/media/libcubeb/unresampled-frames.patch b/media/libcubeb/unresampled-frames.patch
new file mode 100644
index 000000000..714f3d4ba
--- /dev/null
+++ b/media/libcubeb/unresampled-frames.patch
@@ -0,0 +1,36 @@
+From 46d12e9ae6fa9c233bc32812b13185ee7df8d3fd Mon Sep 17 00:00:00 2001
+From: Paul Adenot <paul@paul.cx>
+Date: Thu, 10 Nov 2016 06:20:16 +0100
+Subject: [PATCH] Prevent underflowing the number of input frames needed in
+ input when resampling. (#188)
+
+---
+ src/cubeb_resampler_internal.h | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/cubeb_resampler_internal.h b/src/cubeb_resampler_internal.h
+index e165cc2..3c37a04 100644
+--- a/src/cubeb_resampler_internal.h
++++ b/src/cubeb_resampler_internal.h
+@@ -263,9 +263,15 @@ public:
+ * number of output frames will be exactly equal. */
+ uint32_t input_needed_for_output(uint32_t output_frame_count)
+ {
+- return (uint32_t)ceilf((output_frame_count - samples_to_frames(resampling_out_buffer.length()))
+- * resampling_ratio);
+-
++ int32_t unresampled_frames_left = samples_to_frames(resampling_in_buffer.length());
++ int32_t resampled_frames_left = samples_to_frames(resampling_out_buffer.length());
++ float input_frames_needed =
++ (output_frame_count - unresampled_frames_left) * resampling_ratio
++ - resampled_frames_left;
++ if (input_frames_needed < 0) {
++ return 0;
++ }
++ return (uint32_t)ceilf(input_frames_needed);
+ }
+
+ /** Returns a pointer to the input buffer, that contains empty space for at
+--
+2.7.4
+