Opened 18 years ago

Closed 18 years ago

#2822 closed patch (fixed)

Fix a segfault in livetv when switching from a digital to an analog channel

Reported by: jedynamic@… Owned by: danielk
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

The problem is that when switching from a digital to an analog channel in livetv a segfault can occur. I ran this through gdb and noticed that the av_pause_frame.buf somehow became NULL when we where displaying the pause frame. This caused the segfault.

I looked through the code and noticed that the av_pause_frame.buf will always get cleared out when InputChanged?() is called (via a call to DeleteBuffers?()). The only way the pause frame will get recreated is if CreateBuffers?() is called (which ends up calling CreatePauseFrame?()). CreateBuffers?() is only called if we didn't change a codec_id (inside InputChanged?()). If the codec_id changes then we call InitSetupBuffers?(). InitSetupBuffers?() will not recreate the av_pause_frame.buf. Thus, we get the segfault noted above once we try to display a pause frame.

My patch will make InitSetupBuffers?() recreate the pause frame. I have tested a variant of this patch in .20 (only the VideoOutputSubType?() parameter passed is different) and I do not see the segfault anymore.

Jimmy

Attachments (3)

CreatePauseFrame_InitSetupBuffers.patch (482 bytes) - added by jedynamic@… 18 years ago.
gdb.txt (25.0 KB) - added by anonymous 18 years ago.
myth.log (5.0 KB) - added by anonymous 18 years ago.

Download all attachments as: .zip

Change History (9)

Changed 18 years ago by jedynamic@…

comment:1 Changed 18 years ago by danielk

Owner: changed from Isaac Richards to danielk

comment:2 Changed 18 years ago by danielk

Resolution: worksforme
Status: newclosed

I can't reproduce this.

We shouldn't be calling UpdatePauseFrame? during the switch..

Please reopen if you can get a backtrace.

comment:3 Changed 18 years ago by danielk

(In [12494]) Refs #2822. Cleans up PauseFrame? initialization, and clears it to black to avoid potential green screens.

comment:4 Changed 18 years ago by danielk

(In [12562]) Refs #2822. Quiets compiler warning triggered by frame.h change in [12494].

comment:5 Changed 18 years ago by jedynamic@…

Resolution: worksforme
Status: closedreopened

Okay, this is much tougher to reproduce then before, but I finally got it to crash. It actually happened in the same exact place as before (as I remember from my old crashes). I have attached 2 files: myth.log, gdb.txt.

Also, I included some local variable information from the debugger for the current stack frame:

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1278170224 (LWP 29580)] 0x00c12d10 in VideoOutput::CopyFrame? (to=0xb6365a60, from=0xb63efe20) at videooutbase.cpp:1425 1425 memcpy(to->buf, from->buf, from->size);

print *to

$1 = {codec = FMT_RGB24, buf = 0x0, width = 640, height = 480, bpp = 12, size = 460802, frameNumber = 0, timecode = 0, priv = {0x0, 0x0, 0x0, 0x0}, qscale_table = 0x0, qstride = 0, interlaced_frame = 0, top_field_first = 0, repeat_pict = 0, forcekey = 0, pitches = {0, 0, 0}, offsets = {0, 0, 0}} (gdb) print *from $2 = {codec = FMT_YV12, buf = 0xb2fcb000 "", width = 640, height = 480, bpp = 12, size = 460802, frameNumber = 0, timecode = 0, priv = {0x0, 0x0, 0x0, 0x0}, qscale_table = 0x0, qstride = 0, interlaced_frame = 1, top_field_first = 1, repeat_pict = 0, forcekey = 0, pitches = {640, 320, 320}, offsets = {0, 307200, 384000}}

Changed 18 years ago by anonymous

Attachment: gdb.txt added

Changed 18 years ago by anonymous

Attachment: myth.log added

comment:6 Changed 18 years ago by danielk

Resolution: fixed
Status: reopenedclosed

jedynamic, the backtrace does not match up with SVN head.

Make sure you don't have one set of mythtv libs in /usr/lib and another in /usr/local/lib, and try doing a distclean before compiling & installing MythTV.

Note: See TracTickets for help on using tickets.