Slightly reduced AudioRenderThread sleep duration#30
Slightly reduced AudioRenderThread sleep duration#30LukasKastern wants to merge 1 commit intobakjos:masterfrom
Conversation
This fixes a bug where audio samples are missing for some frames and a crackling sound is played
| int64_t dif = endTime - startTime; | ||
| if ( dif < 33333) { | ||
| av_usleep(33333 - dif); | ||
| if ( dif < 32333) { |
There was a problem hiding this comment.
I was thinking about this value, and I think we should calculate it based the audio FPS instead of a fixed value, what do you think? IN your case, what's the FPS ?
There was a problem hiding this comment.
I'm not quite sure about the FPS, we've tested a lot of different videos and all had the same behaviour which was fixed after lowering that value (we also tested RTMP streams).
I guess this value should indeed be calculated by the video FPS since it also drives the playback speed when the Time control is set to audio.
|
Hello. I found this plugin this week and came here to say that fix didn't solve the audio stuttering for me. |
|
@kabassmusic do you have the link to the m3u8 feed and is it public? if not can you give me details about the audio FPS and codec? does it help if you decrease the wait even more? and are you using the audio or video for the sync? |
I was using this HLS demo I found online for testing. https://vd1.wmspanel.com/video_demo/stream/playlist.m3u8 I was using the Audio Master. Video Master made the audio almost nonexistent. I tried decreasing it to a crazy amount like 333. |
|
The demo you send is working fine for us @kabassmusic . We are capping our game to 60fps could it be related to that @bakjos? |
|
Interesting. I tried capping the fps to 60 and even 30. The sleep duration is at 32333, compiled. Enabled settings are: Ran it in Selected Viewport, and Standalone too. EDIT: |
|
Hello again! It seems like this 'fix' only worked with 4.25.4 which was the version we used with commit 517b328. In UE 4.26.2 and the latest master, we hear that sound bug again (with and without this fix). |
|
Very interesting. Glad you were able to figure out it was Unreals fault at least. I was wondering how you got it to work. I'm gonna try this in a 4.25.4 project now then. Oh, just realized it won't compile for 4.25 using the latest version. |
|
UPDATE: After downloading the version you provided where that commit is and after changing location errors of some includes of that version, I have successfully got it to work on 4.25.2. I also didn't use this fix either and it sounds fine to me now. Way better than with 4.26. But that version doesn't compile with 4.26. Another thing I realized is that versions video is faster than the audio when selecting Audio Master. But the video plays fine if it's the Video Master. Could there be a way to combine the effects of Audio and Video Master so that they are equally timed? |
This fixes a permanent crackling sound we did hear which was caused by samples missing for some frames.
Slightly nuding the sleep duration down fixed the issue