Choppy playback of MKV when adjusting audio offset


#1

Hi all. Leia amlogic beta 2 and 3 at least are affected by a regression compared to krypton. If you adjust the audio offset to ahead (slider to the right) the playback start to be choppy and degradate proportional to how much delay you put. Audio delay (slider to the left) does not have any problem.
Avi containers are not affected. On contrary any MKV I have tested are affected, H264, H265 video and any kind of audio codec, both passthrough and not passthrough. I have several amlogic box, both S912 and S905X and they are all affected.
Windows Leia build are not affected.
I cannot test quickly if standard Linux Leia are affected or not, but anyone can easily confirm or not the problem.
Bye


#2

You forgot the logs.


#3

Well, yes, I have anticipated the issue without the logs, because it is not a spot problem, or problem of my setup, I am pretty sure that if you pick up a MKV on your box you can reproduce the issue right now :slight_smile:


#4

I have uploaded the log:
https://paste.kodi.tv/bihavikire
The log include: start of playback set delay offset ahead, then delay, then ahead again, back to 0 and stop playback


#5

@TheCoolest I am inspecting the log, surprising there is no log of the “audio offset” action, but following the LIRC event, there it seems that the problem starts (KEY_RIGHT is increasing of ahead value)

 ```
21:57:16.345 T:4014990128   DEBUG: LIRC: - NEW 6a 0 KEY_RIGHT devinput (KEY_RIGHT)
21:57:16.367 T:4095599200   DEBUG: HandleKey: 168 (0xa8, obc87) pressed, action is Right
21:57:16.374 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:-44ms pts:788.997 Clock:789.041 Level:1 elapsed:0.006ms
21:57:16.410 T:4095599200   DEBUG: CRenderManager::PrepareNextRender  Frame Skip:15 iter.pts:788.997 lf:1 latency:-0.125 Clock:789.077
21:57:16.413 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:-41ms pts:789.038 Clock:789.080 Level:0 elapsed:0.004ms
21:57:16.415 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:-1ms pts:789.080 Clock:789.082 Level:1 elapsed:0.010ms
21:57:16.453 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:1ms pts:789.122 Clock:789.120 Level:2 elapsed:0.005ms
21:57:16.464 T:3394769712   DEBUG: CAMLCodec::GetPicture: VC_BUFFER LEV:29.00 ttd:32ms x:0.001
21:57:16.492 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:3ms pts:789.163 Clock:789.159 Level:3 elapsed:0.005ms
21:57:16.493 T:4095599200   DEBUG: CRenderManager::PrepareNextRender  Frame Skip:16 iter.pts:789.080 lf:1 latency:-0.125 Clock:789.160
21:57:16.493 T:4095599200   DEBUG: CRenderManager::PrepareNextRender  Frame Skip:17 iter.pts:789.122 lf:0 latency:-0.125 Clock:789.160
21:57:16.494 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:44ms pts:789.205 Clock:789.161 Level:1 elapsed:0.005ms
21:57:16.505 T:3394769712   DEBUG: CVideoPlayerVideo::OutputPicture - ttd:75ms pts:789.247 Clock:789.172 Level:2 elapsed:0.005ms

For some reason it seems that the CRenderManager starts to kick in causing frame skip
Then I start to press KEY_LEFT

21:57:27.095 T:4014990128 DEBUG: LIRC: - NEW 69 0 KEY_LEFT devinput (KEY_LEFT)

And there is no CRenderManager anymore and no frame skip, then I press more KEY_RIGHT (causing ahead offset) and again frame skip due to CRenderManager


#6

The audio offset adjusting is broken in Lei for amlogic hw decoding, nor delayed audio doesn’t work - no delay.
I have some idea how to fix this issue, but for now I am very busy, no time.


#8

I am in touch with Sam Nazarko of OMSC about another topic, he said that in OMSC they don’t have issue with audio offset and Leia for HW decoding, saying that maybe there is a patch in their kernel that solves the issue


#9

There is no issue in kernel. The issue is in Kodi Leia. OSMC uses Krypton still.


#10

No, he explicitly mentioned that in his Leia beta there is no issue


#12

I can confirm, that the choppy playback while using audio sync isn’t a problem in OSMC.
But to be honest, I only used this audio delay function exactly once - just to test, if it is a problem in OSMC, too, and this is really the ONLY problem I’ve seen with CoreELEC in the current stable/nightly builds.
You should keep in mind, that Kodi itself is still in beta stage, and there are still a lot of bugs contained.

The main question should be: Why is audio sync this important to you?
Are most of your video files out of sync (bad rip)?
If it is because of a delayed video on your TV (video processing of the TV itself), there should be an option in your AVR to compensate that (auto delay/auto lipsync/…however it is called in your AVR).


#14

It is not a common use case indeed, but some times you may end up in having to adjust it (i.e. using Bluetooth speakers that add a lot of audio delay, or when mixing audio).
@afl1 anything I can do to help in this?