Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


jppoet at gmail

Sep 27, 2008, 4:12 PM

Post #1 of 15 (1191 views)
Permalink
Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content

On Sat, Sep 27, 2008 at 4:33 PM, MythTV <mythtv[at]cvs.mythtv.org> wrote:
> #5749: Internal player stutters on 720p content
> --------------------------------+-------------------------------------------
> Reporter: zgeggy2k[at]yahoo.com | Owner: ijr
> Type: defect | Status: new
> Priority: major | Milestone: unknown
> Component: Video Playback | Version: 0.21-fixes
> Severity: medium | Resolution:
> Mlocked: 0 |
> --------------------------------+-------------------------------------------
>
> Comment(by zgeggy2k[at]yahoo.com):
>

Maybe if you can solve this:

RTCVideoSync: Could not set RTC frequency, Permission denied.

It might help?

John
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


asherml at gmail

Oct 1, 2008, 12:07 PM

Post #2 of 15 (1110 views)
Permalink
Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content [In reply to]

On Tue, Sep 30, 2008 at 1:57 AM, MythTV <mythtv[at]cvs.mythtv.org> wrote:
> #5749: Internal player stutters on 720p content
>
> It appears the the problem occurs when AvFormatDecoder::GetFrame() is
> processing a large number of sequential video packets without any
> intervening audio packets, and the audio output buffers drain. I don't
> know if the problem is that the loop that calls vFormatDecoder::GetFrame()
> is taking too long, or if it is being blocked by a shortage of video
> buffer space. In the log file excerpt that I will attach, the last "audio
> timecode" is processed at 18:52:51.807, the internal audio buffer is empty
> by 18:52:52.047, and the sound card buffer is empty by 18:52:52.385. The
> next "audio timecode" does not occur until 18:52:52.776.

I had this exact problem on my system, though it was both 1080i and
720p -- intermittent audio dropouts. I spent weeks debugging Myth's
audio handling and came to the same conclusions that the audio buffers
were running out. I could never figure out WHY they were running out.
My best guess what that it seemed like a blocked/lost interrupt
causing the audio servicing to stop for an extended period of time.

After poking around the alsa forums/documentation I saw that there are
different "models" for the snd-hda-intel driver. What finally fixed
it for me was adding:

options snd-hda-intel model=targa-dig

to my /etc/modprobe.d/alsa-base file. I'm using a MSI Media Live as
my frontend (Nvidia MCP51 providing ALC883 audio, I think). Obviously
this specific model won't help you if you're not running an MSI board,
but if you are using the snd-hda-intel driver you might want to look
at the available "models" in:

http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt

David.
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


mtdean at thirdcontact

Oct 4, 2008, 9:20 AM

Post #3 of 15 (1053 views)
Permalink
Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content [In reply to]

On 10/03/2008 11:54 AM, MythTV wrote:
> #5749: Internal player stutters on 720p content
> --------------------------------+-------------------------------------------
> Reporter: zgeggy2k | Owner: janne
> Type: defect | Status: assigned
> Priority: major | Milestone: unknown
> Component: Video Playback | Version: 0.21-fixes
> Severity: medium | Resolution:
> Mlocked: 0 |
> --------------------------------+-------------------------------------------
>
> Comment(by zgeggy2k):
>
...
> When you tried to reproduce the problem did you use Fedora 9? (I'm
> wondering if libs/kernel that the frontend relies on have a specific
> behaviour).
> Maybe a scheduler issue (they may have introduced the "Completely Fair
> Scheduler"), but again, without CPU maxed out, it shouldn't be an issue,
> unless there's added latency when switching tasks that would make the
> frontend miss its deadlines.
>
> One thing I haven't tried is running it as root _with_real_time_priority_
> settings (which hopefully even CFS would honor). I'll give it a try.

Do they enable GROUP_SCHED? If so, are they using USER_SCHED as the
"Basis for grouping tasks?" If so, that's almost definitely the issue
and your system configuration should be fixed.

See, also:
http://www.mythtv.org/wiki/index.php/Troubleshooting:Prebuffering_pause#Kernel_Scheduler_Misconfiguration
and http://www.gossamer-threads.com/lists/mythtv/users/349300#349300

Note that the recommended fix there is to use CGROUP_SCHED as the "Basis
for grouping tasks." However, another approach is to continue to use
USER_SCHED and use, IIRC, uevent to recognize the creation of a new uid
and specify the cpu_share for the user, though this approach requires a
lot more work determining the appropriate cpu_share for each user.

Note, also, that even if the system is configured to use CGROUP_SCHED,
it's quite possible to break the configuration by specifying an
inappropriate cpu.share (yes, it really is cpu_share for USER_SCHED and
cpu.share for CGROUP_SCHED...) for some process groups.

To find out if you're using USER_SCHED, run:

if [ -d /sys/kernel/uids ]; then
echo USER_SCHED is enabled.
else
echo USER_SCHED is not enabled.
fi

If you're not, what's the output of:

if [ -d /dev/cpuctl ]; then
find /dev/cpuctl;
fi

Mike
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 4, 2008, 12:12 PM

Post #4 of 15 (1045 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Sat, Oct 04, 2008 at 12:20:17PM -0400, Michael T. Dean wrote:
> On 10/03/2008 11:54 AM, zgeggy2k wrote:
> > One thing I haven't tried is running it as root _with_real_time_priority_
> > settings (which hopefully even CFS would honor). I'll give it a try.
>
> Do they enable GROUP_SCHED? If so, are they using USER_SCHED as the
> "Basis for grouping tasks?" If so, that's almost definitely the issue
> and your system configuration should be fixed.

I have GROUP_SCHED and USER_SCHED enable in my self-compiled kernel
but haven't done anything to explicitly enable it at run-time on
Debian Sid. For grins, I rebuilt and tested a kernel with GROUP_SCHED
and USER_SCHED disabled. It made no difference -- the stuttering is
still there.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


danielk at cuymedia

Oct 4, 2008, 4:49 PM

Post #5 of 15 (1034 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Sat, 2008-10-04 at 14:12 -0500, David Engel wrote:
> On Sat, Oct 04, 2008 at 12:20:17PM -0400, Michael T. Dean wrote:
> > On 10/03/2008 11:54 AM, zgeggy2k wrote:
> > > One thing I haven't tried is running it as root _with_real_time_priority_
> > > settings (which hopefully even CFS would honor). I'll give it a try.
> >
> > Do they enable GROUP_SCHED? If so, are they using USER_SCHED as the
> > "Basis for grouping tasks?" If so, that's almost definitely the issue
> > and your system configuration should be fixed.
>
> I have GROUP_SCHED and USER_SCHED enable in my self-compiled kernel
> but haven't done anything to explicitly enable it at run-time on
> Debian Sid. For grins, I rebuilt and tested a kernel with GROUP_SCHED
> and USER_SCHED disabled. It made no difference -- the stuttering is
> still there.
> David

The problem Michael identified is very interesting and it explains why
I was having performance problems with recent kernels, but I think
Janne just found the root of your problem, the audio in your files is
500 ms behind the video, but in AVFormatDecoder we only read audio
packets as far ahead as we read video packets. Fixing that problem
is not a trivial undertaking, but on the positive side with a just
a little extra work it will probably also speed up channel flipping
and may make XvMC decoding work much more effectively.

Note: To work well, XvMC currently requires a faster CPU than software
decoding, which makes it pretty darn useless. This is probably in large
part because it requires the audio to be decoded in much less time since
we only have 5 usable XvMC frames instead of the 31 we currently have
for software decoding. We may also be able to greatly reduce that 31
frame number with the AVFD refactor in place.

-- Daniel

_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


janne-mythtv at grunau

Oct 4, 2008, 5:28 PM

Post #6 of 15 (1033 views)
Permalink
Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content [In reply to]

On Sunday 05 October 2008 02:08:09 MythTV wrote:
> #5749: Internal player stutters on 720p content
> --------------------------------+------------------------------------
>------- Reporter: zgeggy2k[at]yahoo.com | Owner: janne
> Type: defect | Status: accepted
> Priority: major | Milestone: unknown
> Component: Video Playback | Version: 0.21-fixes
> Severity: medium | Resolution:
> Mlocked: 0 |
> --------------------------------+------------------------------------
>-------
>
> Comment(by dl-mythtv[at]catspoiler.org):
>
> Replying to [comment:22 janne]:
> > please test if t5749_enable_storing_video_pkts.diff fixes the
> > issue.
>
> I still get stuttering and audio underruns with this patch. See
> mythfrontend.log.t5749_enable_storing_video_pkts.diff.

that file is empty


_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


jackanddougal at yahoo

Oct 5, 2008, 9:57 AM

Post #7 of 15 (1004 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

Guys

I have been following this thread in the background and I was just wondering if it was related to the issue I idenetified in #5265. Basically stutteriung can occur if the file has two audio streams with significantly differnt offset from the video. (in my case, one 700ms ahead and one 200ms behind).

Due to a bug in avformat decoder, the wrong audio track can sometimes be used to determine A/V sync status and confuse the player (only generally with XVMC).

Can you try the patch attached to #5265 to see if that fixes your problems (it did for me).

Cheers

Daniel


--- On Sun, 5/10/08, Daniel Kristjansson <danielk[at]cuymedia.net> wrote:

> From: Daniel Kristjansson <danielk[at]cuymedia.net>
> Subject: Re: [mythtv] Ticket #5749: Internal player stutters on 720p content
> To: "Development of mythtv" <mythtv-dev[at]mythtv.org>
> Date: Sunday, 5 October, 2008, 12:49 AM
> On Sat, 2008-10-04 at 14:12 -0500, David Engel wrote:
> > On Sat, Oct 04, 2008 at 12:20:17PM -0400, Michael T.
> Dean wrote:
> > > On 10/03/2008 11:54 AM, zgeggy2k wrote:
> > > > One thing I haven't tried is running it
> as root _with_real_time_priority_
> > > > settings (which hopefully even CFS would
> honor). I'll give it a try.
> > >
> > > Do they enable GROUP_SCHED? If so, are they
> using USER_SCHED as the
> > > "Basis for grouping tasks?" If so,
> that's almost definitely the issue
> > > and your system configuration should be fixed.
> >
> > I have GROUP_SCHED and USER_SCHED enable in my
> self-compiled kernel
> > but haven't done anything to explicitly enable it
> at run-time on
> > Debian Sid. For grins, I rebuilt and tested a kernel
> with GROUP_SCHED
> > and USER_SCHED disabled. It made no difference -- the
> stuttering is
> > still there.
> > David
>
> The problem Michael identified is very interesting and it
> explains why
> I was having performance problems with recent kernels, but
> I think
> Janne just found the root of your problem, the audio in
> your files is
> 500 ms behind the video, but in AVFormatDecoder we only
> read audio
> packets as far ahead as we read video packets. Fixing that
> problem
> is not a trivial undertaking, but on the positive side with
> a just
> a little extra work it will probably also speed up channel
> flipping
> and may make XvMC decoding work much more effectively.
>
> Note: To work well, XvMC currently requires a faster CPU
> than software
> decoding, which makes it pretty darn useless. This is
> probably in large
> part because it requires the audio to be decoded in much
> less time since
> we only have 5 usable XvMC frames instead of the 31 we
> currently have
> for software decoding. We may also be able to greatly
> reduce that 31
> frame number with the AVFD refactor in place.
>
> -- Daniel
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev[at]mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev



_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 5, 2008, 12:05 PM

Post #8 of 15 (995 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Sun, Oct 05, 2008 at 04:57:01PM +0000, Daniel and Mary-Beth Sherwood wrote:
> Can you try the patch attached to #5265 to see if that fixes your
> problems (it did for me).

No change here.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


janne-mythtv at grunau

Oct 7, 2008, 12:41 PM

Post #9 of 15 (916 views)
Permalink
Re: [mythtv-commits] Ticket #5749: Internal player stutters on 720p content [In reply to]

On Tuesday 07 October 2008 21:07:12 MythTV wrote:
> #5749: Internal player stutters on 720p content
>
> Comment(by gigem):
>
> Replying to [comment:32 janne]:
> > and again, it looks like the audio is to blame. It stores
> > compressed
>
> video frames until AV-sync is should be ok. but fails then to
> decode/play the audio properly.
>
> As soon as we get the audio 100ms ahead of the video, we start
> consuming the stored video packets. The problem is that we then
> continue consuming the stored video packets until they are exhausted.

That seems to be happening on systems which exhibit the problem. It
doesn't happen on my system. Here are stored video packets stored or
consumed according to AV-sync status.

> In the mean time, we run out of audio data and get the underruns.
> We need to detect when we are running out of audio data and start
> storing video packets again until we get more audio data.

There is a bug/race condition in the code which does that if your
analysis is correct.

My last patch should reveal that's happening with the audio.

Janne
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 7, 2008, 2:06 PM

Post #10 of 15 (915 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Tue, Oct 07, 2008 at 09:41:45PM +0200, Janne Grunau wrote:
> On Tuesday 07 October 2008 21:07:12 MythTV wrote:
> > In the mean time, we run out of audio data and get the underruns.
> > We need to detect when we are running out of audio data and start
> > storing video packets again until we get more audio data.
>
> There is a bug/race condition in the code which does that if your
> analysis is correct.

Agreed. I've been looking at the code today and can't see why it does
what it's doing for me. I intend to do debugging on my own tonight
now that I know whch area of code to look at.

> My last patch should reveal that's happening with the audio.

I hadn't noticed you had a new patch until I saw this. Trac doesn't
send an email when only an attachment is added.

Your latest changes is exactly what I was doing to try first myself.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 7, 2008, 7:56 PM

Post #11 of 15 (905 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Tue, Oct 07, 2008 at 04:06:35PM -0500, David Engel wrote:
> On Tue, Oct 07, 2008 at 09:41:45PM +0200, Janne Grunau wrote:
> > My last patch should reveal that's happening with the audio.
>
> I hadn't noticed you had a new patch until I saw this. Trac doesn't
> send an email when only an attachment is added.
>
> Your latest changes is exactly what I was doing to try first myself.

I had a family event scheduled for me this evening so I got a late
start and didn't has as much time as I'd hoped. I think I made some
good progress, though.

I uploaded a new log to Trac for your v2 diff. It includes some
additional logging added by me to track when lastapts is set.
MpegPreProcessPkt gets called when a change in fps is detected and it
zeros out lastapts. If this occurs while we are processing stored
video packets, lastaps doesn't get reset to anything meaningful until
we finish processing all of the stored video packets and another audio
packet is processed.

This probably isn't the proper fix, but as a test, I commented out the
the following line in MpegPreProcessPkt:

lastapts = lastvpts = lastccptsu = 0;

That resulted in smooth playback for me.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 7, 2008, 10:45 PM

Post #12 of 15 (895 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Tue, Oct 07, 2008 at 09:56:34PM -0500, David Engel wrote:
> I uploaded a new log to Trac for your v2 diff. It includes some
> additional logging added by me to track when lastapts is set.
> MpegPreProcessPkt gets called when a change in fps is detected and it
> zeros out lastapts. If this occurs while we are processing stored

Clarification. MpegPreProcessPkt zeros lastapts when an fps, width,
height or aspect change is detected -- not MpegPreProcessPkt gets called
when...

> video packets, lastaps doesn't get reset to anything meaningful until
> we finish processing all of the stored video packets and another audio
> packet is processed.

One more tidbit of information before I call it a night. This may
have reached Heisenbug status. Check the new patch I uploaded and
look for the Heisenbug comment. For me, I get stuttering with those
four VERBOSE calls #if'd out and no stuttering with those VERBOSE calls
#if'd in.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


linuxdreas at dslextreme

Oct 9, 2008, 5:12 PM

Post #13 of 15 (823 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

Am Tuesday 07 October 2008 22:45:18 schrieb David Engel:
> One more tidbit of information before I call it a night. This may
> have reached Heisenbug status. Check the new patch I uploaded and
> look for the Heisenbug comment. For me, I get stuttering with those
> four VERBOSE calls #if'd out and no stuttering with those VERBOSE calls
> #if'd in.

I don't know what a Heisenbug is, but I can confirm that by simply having the
verbose calls in the code, the stuttering goes away, except in some rare
cases when I jump back and forth through a recording.

Without the verbose calls (I commented them out), the buffer underrun messages
and the stuttering don't change.

This happens with and without logging of audio and playback.

--
Gruß
Andreas
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at istwok

Oct 9, 2008, 7:41 PM

Post #14 of 15 (816 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

On Thu, Oct 09, 2008 at 05:12:22PM -0700, Andreas wrote:
> I don't know what a Heisenbug is, but I can confirm that by simply having the

http://en.wikipedia.org/wiki/Heisenbug

> This happens with and without logging of audio and playback.

Please try the proposed fix I just attached to the ticket.

David
--
David Engel
david[at]istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


linuxdreas at dslextreme

Oct 9, 2008, 11:22 PM

Post #15 of 15 (800 views)
Permalink
Re: Ticket #5749: Internal player stutters on 720p content [In reply to]

Am Thursday 09 October 2008 19:41:04 schrieb David Engel:
> On Thu, Oct 09, 2008 at 05:12:22PM -0700, Andreas wrote:
> > I don't know what a Heisenbug is, but I can confirm that by simply having
> > the
>
> http://en.wikipedia.org/wiki/Heisenbug
>
> > This happens with and without logging of audio and playback.
>
> Please try the proposed fix I just attached to the ticket.
>
> David

I tried your patch (t5749_proposed_fix.diff) and as far as I can tell, it
works beautifully on 720p60 recordings, and my 1080i30 and SD recordings are
still playing fine. So, thumbs up and a big thanks from me!

Oh, and I attached a logfile from playing a 720p60 recording to the ticket
(t5749_proposed_fix.diff.log)

--
Gruß
Andreas
_______________________________________________
mythtv-dev mailing list
mythtv-dev[at]mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.