Opened 15 years ago

Closed 15 years ago

#1716 closed defect (fixed)

Decoder locking in NuppelVideoPlayer

Reported by: dm@… Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no


I have noticed a number of crashes in the frontend when changing channels but hadn't been able to pin it down to anything until it happened last week when I was running under gdb. I managed to get a backtrace (attached) but I've since investigated it a bit further. The crash happened in a function called from NuppelVideoPlayer::SetWatchingRecording? and it appeared that the decoder object had changed under the feet of the function.

(gdb) up
#5  0x00b25d04 in NuppelVideoPlayer::SetWatchingRecording (this=0x8e986b8,
    mode=false) at NuppelVideoPlayer.cpp:338
338             GetDecoder()->setWatchingRecording(mode);
(gdb) print decoder
$22 = (class DecoderBase *) 0xa96028f0
(gdb) down
#4  0x00b5e94e in DecoderBase::setWatchingRecording (this=0xaa31a4d8,
    mode=false) at decoderbase.cpp:95
95              SyncPositionMap();
(gdb) print this
$23 = (DecoderBase * const) 0xaa31a4d8

It seems that NVP creates a new thread that at some point calls SetDecoder? to update the decoder but there is no locking to ensure that another thread is not using the decoder object. I wanted to confirm that there really was a problem so the attached patch contains calls to sleep and printf to demonstrate the problem. There's also the beginnings of a fix although someone who knows the code better may well come up with something better. There may be other functions that need to lock the decoder object.


Attachments (2) (23.8 KB) - added by dm@… 15 years ago.
demopatch.txt (1.7 KB) - added by dm@… 15 years ago.

Download all attachments as: .zip

Change History (3)

Changed 15 years ago by dm@…

Attachment: added

Changed 15 years ago by dm@…

Attachment: demopatch.txt added

comment:1 Changed 15 years ago by Isaac Richards

Resolution: fixed
Status: newclosed

(In [10029]) Add a mutex for the decoder object. Prevents callback from TV class from using an outdated decoder object.

Based on patch from #1716.

Closes #1716.

Note: See TracTickets for help on using tickets.