Skipping every 4 seconds on MediaPortal DVB radio

Discussion in 'ReClock' started by el Filou, Sep 14, 2015.

  1. el Filou

    el Filou Well-Known Member

    EDIT: after 3 years using workarounds, I finally found the root cause of this issue. Explanation in this thread:


    I recently upgraded my HTPC to Windows 10 (64) from Windows XP, and I have a problem with ReClock in a very specific case.

    I use MediaPortal, and I configured ReClock to be used when playing video.
    The thing is, MediaPortal considers that when you play an MPEG TS file, you're watching a "TV" source, which is technically correct as it comes from the TV tuner card, but that means it also considers DVB radio, i.e. a TS source with just an audio channel and no video, as TV and so it also uses ReClock to play it. This means I can't disable ReClock just for DVB radio as it would be disabled also for playing video TS files and I obviously don't want that.
    My problem is that when playing DVB radio, the sound is skipping every ~4 seconds.

    Some technical information:
    - I use LAV Audio Decoder, in MediaPortal as well as in MPC-HC, and I use the external filter so it's the same version in both with the same config.
    - the playback is not really live from the tuner card, as MediaPortal is always buffering "TV" streams to a TS file on disk and then playing that file, so it's like playing any file really, with the difference that it's being written to at the same time.
    - Playing "live" TV the same way with ReClock in MediaPortal poses no problem at all (with or without PAL speeddown).
    - Playing the file in MPC-HC with ReClock while MP is recording to it poses no problem.
    - Using the system default audio renderer instead of ReClock works fine.
    - The same situation worked flawlessly under Windows XP with Kernel Streaming.
    - MediaPortal developers don't support ReClock and will ask to use their own MediaPortal audio renderer that also does resampling and clock-matching, but it is useless to me as it doesn't support PAL speeddown and setting speaker config that matches the source.
    - If I check ReClock properties while playing in MediaPortal (see attached picture), when it is skipping I can see "24 ms samp" changing very briefly to "0 ms samp"

    Here is what I tried to troubleshoot. None of those things changed anything.

    - Pause the "live" stream so as to have more data on disk, in case it was a file buffer size problem. I paused for as long as one minute (about 1,5 MB file buffer on disk).
    - Disabling "Auto A/V Sync correction" in LAV Decoder
    - Using DirectSound and WaveOut output in ReClock
    - Using higher prebuffer values (up to 1000 ms)
    - Using lower Sinc resampling quality and output sample rate

    I have attached log files from when I tried to listen to a radio channel. I started the channel, then hit pause for ~10 seconds, then let it play until it had skipped 4 times and then pressed Stop.
    I also included the logs from MediaPortal if it can be of any use (TsReader is the splitter MP uses).

    Do you think there is anything that can be done on ReClock's side, or is the problem mostly on the player's side?

    Thanks a lot for any help, best regards.

    Attached Files:

    Last edited: Sep 22, 2018
  2. James

    James Redfox Development Team Staff Member

    According to the ReClock log, pause was pressed multiple times. Apart from this, I don't see anything wrong. It detects, that there is no video to sync and just renders the audio to wasapi. It might be a ReClock bug, of course, but I believe I tested this with simple audio file playback.
    el Filou likes this.
  3. el Filou

    el Filou Well-Known Member

    Thanks for having a look at it!
    Indeed it looks like MediaPortal's player is trying to synchronize with the audio renderer, and maybe because ReClock is confusing it in a way DirectSound wouldn't, it regularly pauses to "allow the renderer to catch up":

    [49,001] - audPin : Audio to render late= 0.023
    [49,001] - Aud/Ref : 26.748, Compensated = 26.840 ( 0.023 A/V buffers=81/00), Clk : 26.816772, SampCnt 222, Sleep 1 ms, stallPt 1.100
    [49,120] - Aud/Ref : 26.868, Compensated = 26.960 ( 0.023 A/V buffers=82/00), Clk : 26.937269, SampCnt 223, Sleep 1 ms, stallPt 1.100
    [49,242] - Aud/Ref : 26.988, Compensated = 27.080 ( 0.022 A/V buffers=81/00), Clk : 27.058159, SampCnt 224, Sleep 1 ms, stallPt 1.100
    [49,364] - Aud/Ref : 27.108, Compensated = 27.200 ( 0.020 A/V buffers=80/00), Clk : 27.180358, SampCnt 225, Sleep 1 ms, stallPt 1.100
    [50,320] - audPin : Audio to render late= 0.024
    [51,640] - audPin : Audio to render late= 0.024
    [52,932] - Pause 195 mS renderer clock to match provider/RTSP clock, A/V = 50/0
    [53,130] - Run() - Elapsed time from pause to Audio/Video ( total zapping time ) : 196 mS

    I don't really understand why.

    You can also see this message pop up in its log:

    [2015-09-14 12:31:14,880] [ c5cf8b0] [ f0c] - audPin:CompleteConnect() ok, filter: LAV Audio Decoder
    [2015-09-14 12:31:14,981] [ c5cf8b0] [ f0c] - ReClock found

    which is weird. Looks like it's detecting ReClock and changing its behaviour? I guess it would work better if it would leave ReClock alone. :rolleyes:

    I'll try setting ReClock to stealthily replace the default renderer, and see if that can fool MP.:cool: If not I'll bring this up with the devs, but I have little hope.