MediaPortal Audio renderer - better video playback quality (3 Viewers)

davidf

Retired Team Member
  • Premium Supporter
  • April 3, 2006
    796
    348
    Scotland
    Home Country
    Scotland Scotland
    I can provide following kind of information quite easialy: xxx ms of audio stream was resampled into yyy ms

    would be perfect along hwClock and hwQpcClock. This with the calculated display cycle and video framerate would allow someone with too much time (my wife says otherwise) to reconstruct the timeline of audio and video. Ignoring the adjustment would help with the reconstruction as only the bias (known and static) and m_dSystemClockMultiplier to worry about.
     

    djphatic

    Portal Pro
    May 9, 2008
    70
    1
    Home Country
    United Kingdom United Kingdom
    Could anyone clear a couple of things before I give this try:

    Does this support any kind of PAL SpeedDown 25fps > 23.976fps and if so, is this automated based on 25fps material or does it have to be set manually?

    With regards to bitstream, can I playback DTS-MA/True-HD via ffdshow with this audio renderer or is this a no go?

    Thanks
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Does this support any kind of PAL SpeedDown 25fps > 23.976fps and if so, is this automated based on 25fps material or does it have to be set manually?

    Should be working. Speedup / speed down is done for all material to match the refresh rate if the allowed speed up / slow down window permits it.

    With regards to bitstream, can I playback DTS-MA/True-HD via ffdshow with this audio renderer or is this a no go?

    Bitstreaming is technically impossible since we want to be able to resample the audio stream (to gain the stutter free video)

    Please see 1st post for more information on both topics.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    davidf, something to be analyzed. As attachements two logs, one from HTPC where the drifting happens and one from the dev PC where I haven't spotted any drifting.

    Code:
    REFERENCE_TIME CSyncClock::GetPrivateTime()
    {
      CAutoLock cObjectLock(this);
    
      UINT64 qpcNow = GetCurrentTimestamp();
    
      DWORD dwTime = timeGetTime();
    
      UINT64 hwClock(0);
      UINT64 hwQpc(0);
    
      UINT64 hwClockEnd(0);
      UINT64 hwQpcEnd(0);
    
      HRESULT hr = m_pAudioRenderer->AudioClock(hwClock, hwQpc);
    
      if (hr == S_OK)
      {
        if (m_dStartQpcHW == 0)
          m_dStartQpcHW = hwQpc;
    
        if (m_dStartTimeHW == 0)
          m_dStartTimeHW = hwClock;
    
        if (m_dStartTimeSystem == 0)
          m_dStartTimeSystem = dwTime;
    
        if (m_dStartTimeCorrected == 0)
          m_dStartTimeCorrected = m_rtPrivateTime;
    
        m_dDurationHW = (hwClock - m_dStartTimeHW) / 10000;
        m_dDurationSystem = (dwTime - m_dStartTimeSystem); 
        m_dDurationCorrected = (m_rtPrivateTime - m_dStartTimeCorrected) / 10000;
    
        //if (hwQpc < m_dPrevQpcHW)
          //Log("%I64d", hwQpc - m_dPrevQpcHW);
    
        if (m_dPrevTimeHW > hwClock)
        {
          m_dStartTimeHW = m_dPrevTimeHW = hwClock;
          m_dStartQpcHW = m_dPrevQpcHW = hwQpc;
          m_dStartTimeSystem = dwTime;
          m_dStartTimeCorrected = m_rtPrivateTime;
          m_llDeltaError = 0;
          overallCorrection = 0;
        }
        else
        {
          double clockDiff = hwClock - m_dStartTimeHW;
          double qpcDiff = hwQpc - m_dStartQpcHW;
    
          if (clockDiff > 0 && qpcDiff > 0)
            m_dSystemClockMultiplier = clockDiff / qpcDiff;
    
          if (m_dSystemClockMultiplier < 0.95 || m_dSystemClockMultiplier > 1.05)
            m_dSystemClockMultiplier = 1.0;
    
          m_dPrevTimeHW = hwClock;
          m_dPrevQpcHW = hwQpc;
        }
      }
      else
      {
        //Log("AudioClock() returned error (0x%08x)");
      }
    
      REFERENCE_TIME delta = REFERENCE_TIME(dwTime) - REFERENCE_TIME(m_dwPrevSystemTime);
      REFERENCE_TIME deltaOrig = delta;
    
      if (dwTime < m_dwPrevSystemTime)
      {
        delta += REFERENCE_TIME(UINT_MAX) + 1;
      }
    
      m_dwPrevSystemTime = dwTime;
      delta = (REFERENCE_TIME)(delta * (UNITS / MILLISECONDS));
      double dAdjustment;
      if (m_bHWBasedRefClock)
      {
        dAdjustment = m_dAdjustment * m_dBias / m_dSystemClockMultiplier;
      }
      else
      {
        dAdjustment = m_dAdjustment * m_dBias;
      }
      double ddelta= ((double) delta)*dAdjustment;
      delta = (REFERENCE_TIME) ddelta;
      m_ddeltaError += ddelta - delta;
      if (m_ddeltaError>1.0)
      {
        delta--;
        m_ddeltaError-=1.0;
        overallCorrection += 1.0;
      }
      
      if (hwQpc - m_dStartQpcHW > 600000000)
      {
        Log("mul: %.10f de: %6I64d de.orig: %6I64d de.err: %.10f bias: %.10f adj: %.10f hwQpc: %I64d hwClock: %I64d", 
          m_dSystemClockMultiplier, delta, deltaOrig * 10000, m_ddeltaError, m_dBias, m_dAdjustment, hwQpc, hwClock);
      }
    
      m_rtPrivateTime = m_rtPrivateTime + delta;
    
      return m_rtPrivateTime;
    }
     

    Attachments

    • AudioRenderer_dev_PC.zip
      1.5 MB
    • AudioRenderer_HTPC.zip
      1.6 MB

    Henkie Flits

    Portal Pro
    November 1, 2008
    210
    44
    Home Country
    Netherlands Netherlands
    Tourettes: I have a problem: when playing AVI file in MePo using SAF5 and the V12 renderer I get no sound. I attached both graphs:
    AVI-nosound - MePo, SAF5 and V12 renderer but gives me no sound
    AVI-sound - MPC-HC
     

    Attachments

    • AVI-sound.jpg
      AVI-sound.jpg
      25.2 KB
    • AVI-nosound.jpg
      AVI-nosound.jpg
      21.6 KB

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Tourettes: I have a problem: when playing AVI file in MePo using SAF5 and the V12 renderer I get no sound. I attached both graphs:
    AVI-nosound - MePo, SAF5 and V12 renderer but gives me no sound
    AVI-sound - MPC-HC

    Please post log and ffdshow setting screen shots for 1) mixer screen 2) output screen 3) resampling screen. SAF might be having pretty bad settings for ffdshow. Currently I'm not recommending using SAF for testing at all.
     

    hoborg

    Portal Pro
    June 13, 2008
    4,413
    1,644
    Nový Jičín
    Home Country
    Czech Republic Czech Republic
    Please post log and ffdshow setting screen shots for 1) mixer screen 2) output screen 3) resampling screen. SAF might be having pretty bad settings for ffdshow. Currently I'm not recommending using SAF for testing at all.

    Only if passthrough is enabled, default setting should be OK, just disable mixer - there is stereo output as default.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Please post log and ffdshow setting screen shots for 1) mixer screen 2) output screen 3) resampling screen. SAF might be having pretty bad settings for ffdshow. Currently I'm not recommending using SAF for testing at all.

    Only if passthrough is enabled, default setting should be OK.

    ONLY :p That will kill the audio renderer's ability to work completely (I even wonder why it was able to connect, since even that should fail for passthru formats - but I need a log to analyze that). Please have a look on the first post for more technical details.
     

    Users who are viewing this thread

    Top Bottom