Bug 1473

Summary: ALAudioSink: AV Synchronization Broken, Regression in-between JogAmp Version [2.4.0 - 2.5.0]
Product: [JogAmp] Joal Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 2.6.0   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
gluegen e23a4c7fcc0b585c0708be114fa364e391da4843 joal edf181e8a75f41c7d7e8de5d65c51d66f01fd61c jogl d0dd0c04463c6b09b1f15ce6cc3a2c50286c57bf
Workaround: ---
Bug Depends on:    
Bug Blocks: 1472    

Description Sven Gothel 2023-10-04 09:54:09 CEST
See related Bug 1472, as detected here there first.
Comment 1 Sven Gothel 2023-10-04 11:19:47 CEST
commit edf181e8a75f41c7d7e8de5d65c51d66f01fd61c 

    Bug 1473 - ALAudioSink: AV Synchronization Broken, Regression in-between JogAmp Version [2.4.0 - 2.5.0]
    
    - Adopt to simplified AudioSink
      - Add lastBufferedPTS and expose it
    - Cleanup short* and perf*String() trace/debug presentations to simplify review
      - Hence drop growBuffers()
    - Set initial avgFrameDuration to latency, at least a good start
    
    +++
    
    dequeueBuffer(..):
    - Pass releaseBufferCountReq directly, tangible only if wait == true,
      have enqueueData(..) determine the wait and releaseBufferCountReq value.
    - Drop dequeueBuffer(..) overload caller, simplifying code
    - Don't change playingPTS(..) in overload caller, enqueueData(..) takes care of it
    - Align DEBUG trace with enqueueData(..) to simplify review
    - Otherwise no semnatic change in dequeueBuffer(..)
    
    enqueueData(..):
    - Dropped growBuffers()
    - Show DEBUG trace before actual dequeueBuffer(..) to have meanigful output
    - SOFT (no-wait) dequeueBuffer(..) triggers on 2/3rd full queue
    - HARD (wait) dequeueBuffer(..) if queue is full
    - Set playingPTS, either use
      - old queue-tip (too old) and add (forward) 60% of queue-buffer time
      - new queue-tail (too young), subtract (delay) 40% of queue-buffer time
Comment 2 Sven Gothel 2023-10-04 11:20:51 CEST
Commit e23a4c7fcc0b585c0708be114fa364e391da4843

    AudioSink: Just pass a finte buffer size (KISS), add getLastBufferedPTS() to access the last buffered audio pts
Comment 3 Sven Gothel 2023-10-04 11:36:43 CEST
Commit d0dd0c04463c6b09b1f15ce6cc3a2c50286c57bf

ALAudioSink: AV Synchronization: Adopt to JOAL ALAudioSink changes
    
    FFMPEGMediaPlayer: This also effectively reduces the audio buffer size from 3000ms -> 768ms,
    the new default for audio streams with video.
Comment 4 Sven Gothel 2023-10-15 07:16:18 CEST
Resolved, see further fixes in Bug 1472