Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: vdr with dxr3 & dvb subtitles leaking memory



----- Original Message ----- 
From: "Laz" <laz@club-burniston.co.uk>
To: <vdr@linuxtv.org>
Sent: Wednesday, July 21, 2004 12:32 AM
Subject: [vdr] Re: vdr with dxr3 & dvb subtitles leaking memory


> On Tuesday 20 Jul 2004 21:45, Christian Gmeiner wrote:
>
> > > I uncommented one usleep(10000) line from there. Was that the correct
> > > action to do?
> >
> > There should be _two_ usleep(10000) to uncomment!
>
> I'm seeing glitches when playing back recordings (live TV seems pretty
much
> OK). The dxr3plugin.log reports:
>
> cDxr3AudioDecoder::Decode Found different audio header -> init
> cDxr3AduioDecoder::Decode Old header 0xff new header 0x70a4fcff
> cDxr3AudioDecoder::Decode Sample rate = 48000
> cDxr3AudioDecoder::Decode channels = 2

Look here at the history of pre2, which is in work:

- maybe a little audiofix: lastHeader in cDxr3AudioDecoder will now set to 0
  with the constr. and not via Init()-function. So there should be now some
lesser
  audio scratches.

>
> when this happens (where the new header varies but ends in 4fcff).
Bizarrely,
> I cannot hear an audio glitch but it is obvious in the video! Not sure if
> this is due to erros in the stream or what. The audio-video sync can drift
> quite drastically, too. From what I remember, this was during replay of
> recordings only. Sometimes, it doesn't seem to 'lock on' to the start of a
> recording, giving lots of glitches. Cured by jumping forward!
>
> Maybe some of the problems are caused by the plugin grabbing all the CPU
time!
>
> What do the usleep statements do? I had a brief look at the code but
couldn't
> work it out.

Ok.... i am to lazy to write a patch for this, so repace the following two
functions
in dxr3outputthread.c

// ==================================
// thread action
void cDxr3AudioOutThread::Action()
{
    bool resync = false;
    uint32_t pts = 0;

    cLog::Instance() << "cDxr3AudioOutThread::Action Thread started\n";

    sched_param temp;
    temp.sched_priority = 2;

    if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp))
 {
  cLog::Instance() << "cDxr3AudioOutThread::Action(): Error can't set
priority\n";
    }

    while (!GetStopSignal())
 {
  pts = 0;
        cFixedLengthFrame* pNext = m_buffer.Get();

        if (pNext) pts = pNext->GetPts();

        if (pts && abs((int)pts-(int)SCR) > 30000 ||
m_dxr3Device.IsExternalReleased())
  {
   if (cDxr3ConfigData::Instance().GetDebugEverything())
   {
    cLog::Instance() << "cDxr3AudioOutThread::Action " << "pts = " << pts <<
" scr = " << SCR << "\n";
   }
            m_buffer.Clear();
            m_bNeedResync = true;
        }
  else if (pNext)
  {
            if (!pts || pts < SCR)
   {
    if (cDxr3ConfigData::Instance().GetDebugEverything())
    {
//     if (pts) cLog::Instance() << "cDxr3AudioOutThread::Action pts " <<
pNext->GetPts() << " scr " << SCR << " delta " << (pts - SCR) << "\n";
    }
                if (!pts && resync)
    {
                    continue;
                }
    else
    {
                    resync = false;
                }

                if (pts && (pts < SCR) && ((SCR - pts) > 5000))
    {
     if (cDxr3ConfigData::Instance().GetDebugEverything())
     {
//      cLog::Instance() << "cDxr3AudioOutThread::Action pts audio too small
" << (SCR - pts) << "\n";
     }
                    m_dxr3Device.SetSysClock(pts+ 1 * AUDIO_OFFSET);
                    m_dxr3Device.PlayAudioFrame(pNext);
                    if (m_buffer.IsPolled())
     {
                        m_buffer.Clear();
                        m_bNeedResync = true;
                    }
                }
    else
    {
     if (cDxr3ConfigData::Instance().GetDebugEverything())
     {
//      cLog::Instance() << "cDxr3AudioOutThread::Action write audio\n";
     }
                    m_dxr3Device.PlayAudioFrame(pNext);
                    m_buffer.Pop();
                }
            }
   else
   {
                if (abs((int)pts - (int)SCR) < (AUDIO_OFFSET ))
    {
     if (cDxr3ConfigData::Instance().GetDebugEverything())
     {
//      if (pts) cLog::Instance() << "cDxr3AudioOutThread::Action pts " <<
pNext->GetPts() << " scr " << SCR << " delta " << (pts - SCR) << "\n";
     }
                    m_dxr3Device.PlayAudioFrame(pNext);
                    m_buffer.Pop();
                }
            }
        }

        if ((pts > SCR && abs((int)pts - (int)SCR) > AUDIO_OFFSET))
  {
   if (cDxr3ConfigData::Instance().GetDebugEverything())
   {
//    cLog::Instance() << "cDxr3AudioOutThread::Action Stopping audio " <<
SCR << " " << pts << "\n";
   }

            usleep(10000);

   if (cDxr3ConfigData::Instance().GetDebugEverything())
   {
//    cLog::Instance() << "cDxr3AudioOutThread::Action Starting audio " <<
SCR << " " << pts << "\n";
   }
        }
    }
}



And



// ==================================
// thread action
void cDxr3VideoOutThread::Action()
{
    uint32_t pts = 0;
    static uint32_t lastPts = 0;

 cLog::Instance() << "cDxr3VideoOutThread::Action Thread started\n";

    sched_param temp;
    temp.sched_priority = 1;

    if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp))
 {
//        cLog::Instance() << "cDxr3VideoOutThread::Action(): Error can't
set priority\n";
    }

    while (!GetStopSignal())
 {
        cFixedLengthFrame* pNext = m_buffer.Get();
        if (pNext)
  {
            pts = pNext->GetPts();
            if (pts == lastPts) pts = 0;

            if (pts > SCR && abs((int)pts - (int)SCR) < 7500)
   {
                m_dxr3Device.SetPts(pts);
            }

            if (!pts || pts < SCR)
   {
                if (m_buffer.Available())
    {
                   m_dxr3Device.PlayVideoFrame(pNext);
                   m_buffer.Pop();
                }
            }
   else
   {
                if ((pts > SCR) && abs((int)pts - (int)SCR) < 7500)
    {
     if (cDxr3ConfigData::Instance().GetDebugEverything())
     {
//      cLog::Instance() << "cDxr3VideoOutThread::Action pts " << pts << "
scr " << SCR << " delta " << (pts - SCR) << "\n";
     }

                    m_dxr3Device.SetPts(pts);

     if (cDxr3ConfigData::Instance().GetDebugEverything())
     {
//      cLog::Instance() << "cDxr3VideoOutThread::Action done\n";
     }

                    if (m_buffer.Available() && pNext->GetData() &&
pNext->GetCount())
     {
                        m_dxr3Device.PlayVideoFrame(pNext);

      if (cDxr3ConfigData::Instance().GetDebugEverything())
      {
//       cLog::Instance() << "cDxr3VideoOutThread::Action write\n";
      }

                        m_buffer.Pop();

      if (cDxr3ConfigData::Instance().GetDebugEverything())
      {
//       cLog::Instance() << "cDxr3VideoOutThread::Action done pop\n";
      }
                    }
     if (cDxr3ConfigData::Instance().GetDebug())
     {
//      cLog::Instance() << "cDxr3VideoOutThread::Action done complete\n";
     }
                }
    else
    {
                    if (pts < SCR)
     {
      m_dxr3Device.PlayVideoFrame(pNext);
                        m_buffer.Pop();
                    }
                }
            }


            if (m_dxr3Device.IsExternalReleased())
   {
                m_bNeedResync = true;
                m_buffer.Clear();
            }

            if ((pts > SCR && abs((int)pts - (int)SCR) > 7500 ))
   {
    if (cDxr3ConfigData::Instance().GetDebugEverything())
    {
//     cLog::Instance() << "cDxr3VideoOutThread::Action Stopping video "  <<
SCR << " " << pts << "\n";
    }

                usleep(10000);

    if (cDxr3ConfigData::Instance().GetDebugEverything())
    {
//     cLog::Instance() << "cDxr3VideoOutThread::Action Starting video "  <<
SCR << " " << pts << "\n";
    }
            }
        }
    }
}

>
> Recordings from radio channels, i.e. audio only, do not play back well:
after
> a few secods playback, it starts breaking up and then goes silent until
the
> watchdog timer expires. The same audio recordings play back perfectly with
> mpg123 or similar.
I will have a look at it.

>
> > > I also couldn't find pre2 version you mentioned (later in this thread)
> > > from sourceforge. Is it available?
> >
> > It not yet available yet....
>
> Keep at it!

I switched today to 2.6.8-rc2 - after some probelms my vdr runs and i can
develop the whole night on the plugin.

Christian






Home | Main Index | Thread Index