Thanks for the logcat.
From what I understand, the first part takes place, it would seem, regularly (the log is pretty self explanatory)
Code: Select all
11-12 21:07:10.687 11868 11868 I ExoPlayerImpl: Init 48955d2 [ExoPlayerLib/2.10.7] [mdarcy, SHIELD Android TV, NVIDIA, 28]
11-12 21:07:10.726 11868 11868 D EventLogger: state [0.01, 0.00, window=0, true, BUFFERING]
11-12 21:07:10.829 11868 11868 D EventLogger: surfaceSizeChanged [0.12, 0.00, window=0, 1920, 1080]
11-12 21:07:10.835 11868 11868 D EventLogger: timelineChanged [0.12, 0.00, window=0, periodCount=1, windowCount=1, reason=PREPARED
11-12 21:07:10.835 11868 11868 D EventLogger: period [?]
11-12 21:07:10.835 11868 11868 D EventLogger: window [?, false, false]
11-12 21:07:10.835 11868 11868 D EventLogger: ]
11-12 21:07:10.917 11868 11868 D EventLogger: mediaPeriodCreated [0.20, 0.00, window=0, period=0]
11-12 21:07:10.918 11868 11868 D EventLogger: loading [0.21, 0.00, window=0, period=0, true]
11-12 21:07:14.528 11868 11868 D EventLogger: timelineChanged [3.82, 0.00, window=0, period=0, periodCount=1, windowCount=1, reason=DYNAMIC
11-12 21:07:14.529 11868 11868 D EventLogger: period [8201.78]
11-12 21:07:14.529 11868 11868 D EventLogger: window [8201.78, true, false]
11-12 21:07:14.529 11868 11868 D EventLogger: ]
11-12 21:07:14.624 11868 11868 D EventLogger: decoderEnabled [3.91, 0.00, window=0, period=0, video]
11-12 21:07:14.625 11868 11868 D EventLogger: decoderEnabled [3.91, 0.00, window=0, period=0, audio]
11-12 21:07:14.626 11868 11868 D EventLogger: tracksChanged [3.91, 0.00, window=0, period=0,
11-12 21:07:14.626 11868 11868 D EventLogger: Renderer:0 [
11-12 21:07:14.626 11868 11868 D EventLogger: Group:0, adaptive_supported=N/A [
11-12 21:07:14.627 11868 11868 D EventLogger: [X] Track:0, id=1, mimeType=video/dolby-vision, codecs=dvhe.05.06, res=3840x2160, fps=23.976023, supported=YES
11-12 21:07:14.627 11868 11868 D EventLogger: ]
11-12 21:07:14.627 11868 11868 D EventLogger: ]
11-12 21:07:14.627 11868 11868 D EventLogger: Renderer:2 [
11-12 21:07:14.627 11868 11868 D EventLogger: Group:0, adaptive_supported=N/A [
11-12 21:07:14.627 11868 11868 D EventLogger: [X] Track:0, id=2, mimeType=audio/true-hd, channels=8, sample_rate=48000, language=und, supported=YES
11-12 21:07:14.627 11868 11868 D EventLogger: ]
11-12 21:07:14.627 11868 11868 D EventLogger: ]
11-12 21:07:14.627 11868 11868 D EventLogger: ]
11-12 21:07:14.631 11868 11868 D EventLogger: mediaPeriodReadingStarted [3.92, 0.00, window=0, period=0]
11-12 21:07:14.632 11868 11868 D EventLogger: downstreamFormatChanged [3.92, 0.00, window=0, period=0, id=1, mimeType=video/dolby-vision, codecs=dvhe.05.06, res=3840x2160, fps=23.976023]
11-12 21:07:14.694 11868 11868 D EventLogger: decoderInitialized [3.98, 0.00, window=0, period=0, video, OMX.Nvidia.DOVI.decode]
11-12 21:07:14.696 11868 11868 D EventLogger: decoderInputFormatChanged [3.98, 0.00, window=0, period=0, video, id=1, mimeType=video/dolby-vision, codecs=dvhe.05.06, res=3840x2160, fps=23.976023]
11-12 21:07:14.706 11868 11868 D EventLogger: downstreamFormatChanged [3.99, 0.00, window=0, period=0, id=2, mimeType=audio/true-hd, channels=8, sample_rate=48000, language=und]
11-12 21:07:14.865 11868 11868 D EventLogger: decoderInitialized [4.15, 0.00, window=0, period=0, audio, OMX.google.raw.decoder]
11-12 21:07:14.866 11868 11868 D EventLogger: decoderInputFormatChanged [4.15, 0.00, window=0, period=0, audio, id=2, mimeType=audio/true-hd, channels=8, sample_rate=48000, language=und]
11-12 21:07:15.160 11868 11868 D EventLogger: audioSessionId [4.45, 0.00, window=0, period=0, 8009]
11-12 21:07:15.172 11868 11868 D EventLogger: videoSizeChanged [4.46, 0.00, window=0, period=0, 3840, 2160]
11-12 21:07:15.192 11868 11868 D EventLogger: renderedFirstFrame [4.48, 0.00, window=0, period=0, Surface(name=null)/@0xadd393d]
Code: Select all
11-12 21:07:15.209 11868 11906 E AudioTrack: Discontinuity detected [expected 226666, got 14166]
11-12 21:07:15.250 11868 11906 E AudioTrack: Discontinuity detected [expected 240833, got 28333]
11-12 21:07:15.276 11868 11906 E AudioTrack: Discontinuity detected [expected 255000, got 42500]
11-12 21:07:15.305 11868 11906 E AudioTrack: Discontinuity detected [expected 269166, got 56666]
11-12 21:07:15.326 11868 11906 E AudioTrack: Discontinuity detected [expected 283333, got 70833]
11-12 21:07:15.346 11868 11906 E AudioTrack: Discontinuity detected [expected 297500, got 85000]
11-12 21:07:15.366 11868 11906 E AudioTrack: Discontinuity detected [expected 311666, got 99166]
11-12 21:07:15.388 11868 11906 E AudioTrack: Discontinuity detected [expected 325833, got 113333]
11-12 21:07:15.408 11868 11906 E AudioTrack: Discontinuity detected [expected 340000, got 127500]
11-12 21:07:15.428 11868 11906 E AudioTrack: Discontinuity detected [expected 354166, got 141666]
11-12 21:07:15.448 11868 11906 E AudioTrack: Discontinuity detected [expected 368333, got 155833]
11-12 21:07:15.475 11868 11906 E AudioTrack: Discontinuity detected [expected 382500, got 170000]
....................................................
..........................................
...................................
.......................
Translated into human language:
if the difference between the expected playback time and the playback time obtained from the audio analysis is greater than 200000 (microseconds) then calculate the "adjustmentUs" value (line 659) and add it to startMediaTimeUs (line 660).
This operation is repeated for hundreds of times.
I noticed that the difference between the expected value and the one obtained is always 212500 μs (slightly higher than the value in the code).
If you do the maths, the value of adjustmentUs will always be equal to -212500 μs and consequently the value of startMediaTimeUs will be constantly decreased.
What does this mean?
At some point, this line appears in the log
Code: Select all
11-12 21:07:19.035 11868 11868 D EventLogger: loading [8.32, -27.61, window=0, period=0, false]
Instead, it should be positive and it should increase over time (as it happens in all media players).
Here's what happens, the audio is played but the video track is not because it is constantly delayed (it practically never starts).
How do I try to solve the problem?
Increasing the value present in the code (from 200000 μs to 400000 μs).
I don't know why 200000 was chosen (maybe someone can explain it to me).
It seems to me an arbitrary value useful to keep the audio in sync: what could go wrong if I change it slightly?
I don't know if this will solve the problem but there is no harm in trying!
Anyone who agrees with my reasoning can download the new version of the app HERE.
You should already have the server, so I won't upload it this time.
As always let me know (and if possible attach the logs).