From 2c80bb2e6eb12e155d747daf8a08362396d5e0fc Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sun, 15 Oct 2023 07:10:15 +0200
Subject: Bug 1472: Enhance GLMediaPlayer AV Sync: Fix FFMPEGMediaPlayer's
 audio resample: Use swr_get_out_samples(..) to calculate the required output
 sample count

Notable when playing audio with e.g. 24k sample rate on a 48k OpenAL ALAudioSink,
the sample duration was cut in half due to erroneous resampling missing half the required samples.

Using swr_get_out_samples(..) resolves this issue pre swr_convert(..), the resampling.
---
 .../jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/jogl/classes/jogamp/opengl/util/av/impl')

diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
index 71fa70080..d0b6ab7e0 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -51,7 +51,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo  {
 
     private static final List<String> glueLibNames = new ArrayList<String>(); // none
 
-    private static final int symbolCount = 59;
+    private static final int symbolCount = 60;
     private static final String[] symbolNames = {
          "avutil_version",
          "avformat_version",
@@ -127,7 +127,8 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo  {
          "swr_init",
          "swr_free",
          "swr_convert",
-         /* +5  = 59 */
+         "swr_get_out_samples",
+         /* +6  = 60 */
     };
 
     // optional symbol names
@@ -151,6 +152,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo  {
          "swr_init",
          "swr_free",
          "swr_convert",
+         "swr_get_out_samples",
     };
 
     private static final int LIB_COUNT = 5;
-- 
cgit v1.2.3