From f4ab6922a93d349ee5d1a9a90206c6f80ee0c281 Mon Sep 17 00:00:00 2001
From: Xerxes Rånby <xerxes@zafena.se>
Date: Sun, 12 May 2013 11:58:50 +0200
Subject: FFMPEGMediaPlayer: Limit video sync delay to 47ms in order to fix
 audio buffer underrun.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
---
 src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
index 2c7134a44..68914639d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -538,8 +538,8 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
                 // Try sync video to audio
                 final long now_d = now - lastAudioTime;
                 final long pts_d = pts - lastAudioPTS - 444; /* hack 444 == play video 444ms ahead of audio */
-                //final long dt = Math.min(46, Math.abs( (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ) ) ;
-                final long dt = (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ;
+                final long dt = Math.min(47, (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ) ;
+                //final long dt = (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ;
                 lastVideoTime = now;
                 System.err.println("s: pts-v "+pts+", pts-d "+pts_d+", now_d "+now_d+", dt "+dt);
                 
-- 
cgit v1.2.3