XBMC Community Forum
[PATCH] Global AV delay support via advancedsettings.xml - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+--- Thread: [PATCH] Global AV delay support via advancedsettings.xml (/showthread.php?tid=96916)

Pages: 1 2 3 4 5 6 7 8 9


[PATCH] Global AV delay support via advancedsettings.xml - a11599 - 2011-03-15 10:10

The patch was merged on 24 Feb 2012 into master.

Dear All,

I just submitted a patch which enables setting global AV delay. Some displays have complex video processing and can introduce a noticeable delay in video. This functionality can be used to compensate for this within XBMC. The patch enables specifying different delays based on display refresh rate. It can also be used for working around the infamous 24p 250 msec audio delay bug (or whatever it is Smile ).

Global delay is set in advancedsettings.xml. A sample describing supported options is here:

Code:
<advancedsettings>
  <video>

    <!-- Compensate display latency (video lag). Latency is given in msecs. -->
    <latency>

      <!-- Global default display latency -->
      <delay>0</delay>

      <!--
        Override latency for given display (not video) refresh rates.
        When XBMC is in windowed mode, override is ignored. Multiple
        overrides are allowed.

        Syntax of an override entry:
          <refresh>
            <min>, <max> refresh rate range, OR
            <rate> exact refresh rate
            <delay> display latency for the given refresh rate
          </refresh>
       -->

      <!-- Example: display has 125 msec latency at 23-24 Hz -->
      <refresh>
        <min>23</min>
        <max>24</max>
        <delay>125</delay>
      </refresh>

      <!-- Example: display has 50 msec latency at 50 (+/-0.01) Hz -->
      <refresh>
        <rate>50</rate>
        <delay>50</delay>
      </refresh>

    </latency>

  </video>
</advancedsettings>
When XBMC is running in windowed mode, only the default global AV delay is evaluated. Settings in <refresh> tags are ignored. (Fake fullscreen is treated like true fullscreen mode and everything should work.)


- KennethC - 2011-03-17 12:28

This is awesome and it would be very helpful if this got into an upcoming release.


- jmarshall - 2011-03-17 22:27

I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?


- KennethC - 2011-03-17 22:35

jmarshall Wrote:I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?

Is the new AE going to be merged in the next release, or that still an unknown at this point?


- a11599 - 2011-03-18 12:05

jmarshall Wrote:I believe the delay has been taken care of in the AE branch, so once that's merged it may not be needed?

Well, hopefully the 250 ms issue will be solved finally by merging AE (I personally have not tested the AE branch), but the intention of the patch was originally not to fix that issue (it just can be used for that as well as a workaround), but to provide some way to define audio shift for people with "lagging" displays who have no other way to do it (for example because their receiver does not provide such a functionality).


- sonic00 - 2011-03-26 22:43

Hi there.

I have a -300 delay, if I play 24p files.

I tried all "A/V sync methods" in xbmc - settings - videos - playback, but nothing changed - the delay is still there.

So I found this thread and tried the patch. But I guess I missed something.

I already have a working advancedsettings.xml. I copied the code and paste it in my advancedsettings.xml (changed the delay to -300).

But nothing happend. The delay is also with this patch still there. I can change the delay to -3000 or +3000, its always the same. So I guess I forget something, but what?

At the moment I can change the delay over the OSD, but thats awful, cause I have to do it for all my 24p movies.

Any tipps? Do I have to make some other changes in the xbmc settings??


- a11599 - 2011-03-27 08:10

Please post your current advancedsettings.xml.


- sonic00 - 2011-03-27 16:41

I am right, that I have to bulid a complete new xbmc version, where first I have to patch some files? If so, thats what I missed Wink

I thought, I just have to change the advancesettings.xml.

Code:
<advancedsettings>

  <video>
    <!-- Settings to configure global AV (audio) delay. Some displays have complex video processing -->
    <!-- and can introduce a noticeable delay in video. -->

    <globalavdelay>
    
      <!-- Default global AV delay. If not specified, default is 0. -->
      
      <delay>20</delay>

      <!-- AV delay may depend on display refresh rate (not movie fps!). -->
      
      <refresh>
        <min>23</min>             <!-- Define a range between 23-24 Hz -->
        <max>24</max>
        <delay>-300</delay>       <!-- Workaround for the infamous 24p 250 msec audio delay bug -->
      </refresh>
      
      <refresh>
        <rate>60</rate>           <!-- This matches 60 +- 0.01 Hz -->
        <delay>80</delay>         <!-- Compensate for video processing -->
      </refresh>
      
    </globalavdelay>
  </video>

  <useddsfanart>true</useddsfanart>

  <restrictcapsmask>4</restrictcapsmask>

  <videolibrary>
      <hideallitems>true</hideallitems>
      <cleanonupdate>true</cleanonupdate>
  </videolibrary>

  <musiclibrary>
      <hideallitems>true</hideallitems>
  </musiclibrary>

</advancedsettings>



- a11599 - 2011-03-27 20:31

Yep, you have to build your own version to use this patch. Smile


- ashlar - 2011-04-07 14:43

Considering the all around usefulness of this (ie. for people with no AV receivers capable of setting delays), any chance for this to be merged? It definitely seems to go beyond AE.

Although, thinking about it, it might well be that AE will change pretty much everything this is coded for.


- jmarshall - 2011-04-08 00:06

Yeah, which is why we're holding off. AE is getting reasonably close to the point where it can be slotted in to master now.


- ashlar - 2011-04-08 11:20

jmarshall Wrote:Yeah, which is why we're holding off. AE is getting reasonably close to the point where it can be slotted in to master now.
Right. Smile
Thanks for the clarification.


- Krautmaster - 2011-04-28 20:52

damn... i dont find out how to apply this patch.
My 55LX9500 produces a lag of 50-100 ms with post processing. My old pioneer can't compensate this dealy =/

I want to apply this diff. Does anybody have the commands for me. I checked out xbmc Dharma using git. Whats next?

Thanks a lot!!

Edit: Cant be patched to the normal Dharma-PVR release or? AdvancedSettings.cpp and h is missing there


- sonic00 - 2011-10-02 01:45

Hi,

I'm using that patch for Dharma 10.1. So, in the near future, Dharma will replace by Eden, but what happend with that patch? Is it already integrated in Eden, or do we need a new patch for it?

I ask because I definitely need that kind of patch do adjust the audio delay for my TV. Will that be possible in Eden?


- Kalliban - 2011-12-15 20:55

I'm also wondering this. Since the audio engine has been postponed, this patch would be able to treat the symptoms.. Nod