Mailing List Archive

MPEG-4 trouble on SMP
Hi -

I've got a strange problem with mythtv when I use MPEG-4 encoding.
Recordings
work fine, as do playbacks, but when I watch live TV, the video is
corrupted. It looks
mostly fine, but there are blocking artifacts -- blocks of color, white and
black that
fade in and out periodically. I don't have the same problem with rtjpeg,
and the problem
doesn't go away with reduced capture resolution (I tried down to 320 x 200).
I'm running
on a dual 1GHz PIII, and the artifacts go away when I run a non-SMP kernel.
(hence
the subject line)... I looked at the rwlocks in RingBuffer.cpp, but wasn't
familiar
enough with the code to spot the problem (e.g., why is a read-lock used in
the Write
method?). Any ideas?

Thanks in advance,
Samit

PS - Awesome PVR app!
Re: MPEG-4 trouble on SMP [ In reply to ]
On Wed, Oct 30, 2002 at 10:35:50PM -0500, Samit Basu wrote:
> Hi -
>
> I've got a strange problem with mythtv when I use MPEG-4 encoding.
> Recordings work fine, as do playbacks, but when I watch live TV, the video
> is corrupted. It looks mostly fine, but there are blocking artifacts --
> blocks of color, white and black that fade in and out periodically. I
> don't have the same problem with rtjpeg, and the problem doesn't go away
> with reduced capture resolution (I tried down to 320 x 200). I'm running
> on a dual 1GHz PIII, and the artifacts go away when I run a non-SMP
> kernel. (hence the subject line)... I looked at the rwlocks in
> RingBuffer.cpp, but wasn't familiar enough with the code to spot the
> problem (e.g., why is a read-lock used in the Write method?). Any ideas?


I don't have an answer but I can confirm that I've had the same problem on
my Dual Celeron system.

--
Ray
Re: MPEG-4 trouble on SMP [ In reply to ]
On Wed, Oct 30, 2002 at 10:34:32PM -0700, Ray wrote:
> On Wed, Oct 30, 2002 at 10:35:50PM -0500, Samit Basu wrote:
> > Hi -
> >
> > I've got a strange problem with mythtv when I use MPEG-4 encoding.
> > Recordings work fine, as do playbacks, but when I watch live TV, the video
> > is corrupted. It looks mostly fine, but there are blocking artifacts --
> > blocks of color, white and black that fade in and out periodically. I
> > don't have the same problem with rtjpeg, and the problem doesn't go away
> > with reduced capture resolution (I tried down to 320 x 200). I'm running
> > on a dual 1GHz PIII, and the artifacts go away when I run a non-SMP
> > kernel. (hence the subject line)... I looked at the rwlocks in
> > RingBuffer.cpp, but wasn't familiar enough with the code to spot the
> > problem (e.g., why is a read-lock used in the Write method?). Any ideas?
>
>
> I don't have an answer but I can confirm that I've had the same problem on
> my Dual Celeron system.

I can also confirm for a dual 800mhz PIII.
Re: MPEG-4 trouble on SMP [ In reply to ]
On Wednesday 30 October 2002 10:35 pm, Samit Basu wrote:
> Hi -
>
> I've got a strange problem with mythtv when I use MPEG-4 encoding.
> Recordings
> work fine, as do playbacks, but when I watch live TV, the video is
> corrupted. It looks
> mostly fine, but there are blocking artifacts -- blocks of color, white and
> black that
> fade in and out periodically. I don't have the same problem with rtjpeg,
> and the problem
> doesn't go away with reduced capture resolution (I tried down to 320 x
> 200). I'm running
> on a dual 1GHz PIII, and the artifacts go away when I run a non-SMP kernel.
> (hence
> the subject line)... I looked at the rwlocks in RingBuffer.cpp, but wasn't
> familiar
> enough with the code to spot the problem (e.g., why is a read-lock used in
> the Write
> method?). Any ideas?

Probably thread-safety issues in libavcodec that are exposed when running SMP.
Anyone feel like checking that out?

Oh, and the rw locks in the RingBuffer class are locking the 'dumpfd'
variable, which only gets read in the Write method, and modified in
TransitionToFile and TransitionToRing.. It currently is overlocking in there
(the Read method doesn't need a lock), but the additional overhead should be
minimal.

Isaac
Re: MPEG-4 trouble on SMP [ In reply to ]
On Thu, Oct 31, 2002 at 10:01:45AM -0500, Isaac Richards wrote:
> On Wednesday 30 October 2002 10:35 pm, Samit Basu wrote:
> > Hi -
> >
> > I've got a strange problem with mythtv when I use MPEG-4 encoding.
> > Recordings
> > work fine, as do playbacks, but when I watch live TV, the video is
> > corrupted. It looks
> > mostly fine, but there are blocking artifacts -- blocks of color, white and
> > black that
> > fade in and out periodically. I don't have the same problem with rtjpeg,
> > and the problem
> > doesn't go away with reduced capture resolution (I tried down to 320 x
> > 200). I'm running
> > on a dual 1GHz PIII, and the artifacts go away when I run a non-SMP kernel.
> > (hence
> > the subject line)... I looked at the rwlocks in RingBuffer.cpp, but wasn't
> > familiar
> > enough with the code to spot the problem (e.g., why is a read-lock used in
> > the Write
> > method?). Any ideas?
>
> Probably thread-safety issues in libavcodec that are exposed when running SMP.
> Anyone feel like checking that out?
>

I'm not sure if it will help, but when I use ffmpeg's command line tools to record an mpeg4 stream I don't see this behavior. I'm using version 0.4.5 of ffmpeg- I'm not sure when the code was spliced into mythtv, but maybe they've tweaked something since then?
Re: MPEG-4 trouble on SMP [ In reply to ]
On Thursday 31 October 2002 10:13 am, Benjamin Binford wrote:
> I'm not sure if it will help, but when I use ffmpeg's command line tools to
> record an mpeg4 stream I don't see this behavior. I'm using version 0.4.5
> of ffmpeg- I'm not sure when the code was spliced into mythtv, but maybe
> they've tweaked something since then?

You're not recording and playing back in multiple threads against the same
physical codebase in that instance.

Isaac
Re: MPEG-4 trouble on SMP [ In reply to ]
On Thursday 31 October 2002 12:34 am, Ray wrote:
> On Wed, Oct 30, 2002 at 10:35:50PM -0500, Samit Basu wrote:
> > Hi -
> >
> > I've got a strange problem with mythtv when I use MPEG-4 encoding.
> > Recordings work fine, as do playbacks, but when I watch live TV, the
> > video is corrupted. It looks mostly fine, but there are blocking
> > artifacts -- blocks of color, white and black that fade in and out
> > periodically. I don't have the same problem with rtjpeg, and the problem
> > doesn't go away with reduced capture resolution (I tried down to 320 x
> > 200). I'm running on a dual 1GHz PIII, and the artifacts go away when I
> > run a non-SMP kernel. (hence the subject line)... I looked at the
> > rwlocks in
> > RingBuffer.cpp, but wasn't familiar enough with the code to spot the
> > problem (e.g., why is a read-lock used in the Write method?). Any ideas?
>
> I don't have an answer but I can confirm that I've had the same problem on
> my Dual Celeron system.

If you guys with dualies could update to current CVS, edit settings.pro and
uncomment the EXTRA_LOCKING line, recompile, etc, etc, and let me know if
that helps things at all, I'd appreciate it.

Isaac