mirror of
https://github.com/rofafor/vdr-plugin-femon.git
synced 2023-10-10 13:36:53 +02:00
Fixed a deadlock in cFemonReceiver.
This commit is contained in:
parent
427b3023ba
commit
ab8f5f3de8
1
HISTORY
1
HISTORY
@ -319,3 +319,4 @@ VDR Plugin 'femon' Revision History
|
|||||||
- Added a check for the minimum OSD height.
|
- Added a check for the minimum OSD height.
|
||||||
- Replaced "Use single area (8bpp)" option with VDR's "Setup/OSD/Anti-alias".
|
- Replaced "Use single area (8bpp)" option with VDR's "Setup/OSD/Anti-alias".
|
||||||
- Removed the FEMON_NTSC option.
|
- Removed the FEMON_NTSC option.
|
||||||
|
- Fixed a deadlock in cFemonReceiver.
|
||||||
|
2
README
2
README
@ -15,7 +15,7 @@ See the file COPYING for license information.
|
|||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
VDR & DVB. BMW & Ph.D.. BEER. YARRR!
|
VDR and a DVB card.
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
|
26
femonosd.c
26
femonosd.c
@ -173,10 +173,12 @@ cFemonOsd::~cFemonOsd(void)
|
|||||||
if (m_SvdrpPlugin)
|
if (m_SvdrpPlugin)
|
||||||
m_SvdrpPlugin->Service("SvdrpConnection-v1.0", &m_SvdrpConnection);
|
m_SvdrpPlugin->Service("SvdrpConnection-v1.0", &m_SvdrpConnection);
|
||||||
}
|
}
|
||||||
if (m_Receiver)
|
if (m_Receiver) {
|
||||||
delete m_Receiver;
|
m_Receiver->Deactivate();
|
||||||
|
DELETENULL(m_Receiver);
|
||||||
|
}
|
||||||
if (m_Osd)
|
if (m_Osd)
|
||||||
delete m_Osd;
|
DELETENULL(m_Osd);
|
||||||
pInstance = NULL;
|
pInstance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,8 +531,10 @@ void cFemonOsd::Show(void)
|
|||||||
OSDCLEARSTATUS();
|
OSDCLEARSTATUS();
|
||||||
OSDCLEARINFO();
|
OSDCLEARINFO();
|
||||||
m_Osd->Flush();
|
m_Osd->Flush();
|
||||||
if (m_Receiver)
|
if (m_Receiver) {
|
||||||
delete m_Receiver;
|
m_Receiver->Deactivate();
|
||||||
|
DELETENULL(m_Receiver);
|
||||||
|
}
|
||||||
if (femonConfig.analyzestream) {
|
if (femonConfig.analyzestream) {
|
||||||
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||||
if (channel) {
|
if (channel) {
|
||||||
@ -572,8 +576,10 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Receiver)
|
if (m_Receiver) {
|
||||||
delete m_Receiver;
|
m_Receiver->Deactivate();
|
||||||
|
DELETENULL(m_Receiver);
|
||||||
|
}
|
||||||
if (femonConfig.analyzestream) {
|
if (femonConfig.analyzestream) {
|
||||||
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||||
if (channel) {
|
if (channel) {
|
||||||
@ -591,8 +597,10 @@ void cFemonOsd::SetAudioTrack(int Index, const char * const *Tracks)
|
|||||||
int apid[2] = {0, 0};
|
int apid[2] = {0, 0};
|
||||||
int dpid[2] = {0, 0};
|
int dpid[2] = {0, 0};
|
||||||
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
||||||
if (m_Receiver)
|
if (m_Receiver) {
|
||||||
delete m_Receiver;
|
m_Receiver->Deactivate();
|
||||||
|
DELETENULL(m_Receiver);
|
||||||
|
}
|
||||||
if (femonConfig.analyzestream) {
|
if (femonConfig.analyzestream) {
|
||||||
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||||
if (channel) {
|
if (channel) {
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
cFemonReceiver::cFemonReceiver(tChannelID ChannelID, int Ca, int Vpid, int Apid[], int Dpid[])
|
cFemonReceiver::cFemonReceiver(tChannelID ChannelID, int Ca, int Vpid, int Apid[], int Dpid[])
|
||||||
: cReceiver(ChannelID, -1, Vpid, Apid, Dpid, NULL),
|
: cReceiver(ChannelID, -1, Vpid, Apid, Dpid, NULL),
|
||||||
cThread("femon receiver"),
|
cThread("femon receiver"),
|
||||||
|
m_Sleep(),
|
||||||
|
m_Active(false),
|
||||||
m_VideoPid(Vpid),
|
m_VideoPid(Vpid),
|
||||||
m_VideoPacketCount(0),
|
m_VideoPacketCount(0),
|
||||||
m_VideoBitrate(0.0),
|
m_VideoBitrate(0.0),
|
||||||
@ -75,11 +77,20 @@ cFemonReceiver::cFemonReceiver(tChannelID ChannelID, int Ca, int Vpid, int Apid[
|
|||||||
cFemonReceiver::~cFemonReceiver(void)
|
cFemonReceiver::~cFemonReceiver(void)
|
||||||
{
|
{
|
||||||
Dprintf("%s()\n", __PRETTY_FUNCTION__);
|
Dprintf("%s()\n", __PRETTY_FUNCTION__);
|
||||||
|
Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cFemonReceiver::Deactivate(void)
|
||||||
|
{
|
||||||
|
Dprintf("%s()\n", __PRETTY_FUNCTION__);
|
||||||
|
if (m_Active) {
|
||||||
|
m_Active = false;
|
||||||
m_Sleep.Signal();
|
m_Sleep.Signal();
|
||||||
if (Running())
|
if (Running())
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cFemonReceiver::GetVideoInfo(uint8_t *buf, int len)
|
void cFemonReceiver::GetVideoInfo(uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
@ -165,7 +176,7 @@ void cFemonReceiver::Activate(bool On)
|
|||||||
if (On)
|
if (On)
|
||||||
Start();
|
Start();
|
||||||
else
|
else
|
||||||
Cancel();
|
Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFemonReceiver::Receive(uchar *Data, int Length)
|
void cFemonReceiver::Receive(uchar *Data, int Length)
|
||||||
@ -214,7 +225,8 @@ void cFemonReceiver::Action(void)
|
|||||||
{
|
{
|
||||||
Dprintf("%s()\n", __PRETTY_FUNCTION__);
|
Dprintf("%s()\n", __PRETTY_FUNCTION__);
|
||||||
cTimeMs t;
|
cTimeMs t;
|
||||||
while (Running()) {
|
m_Active = true;
|
||||||
|
while (Running() && m_Active) {
|
||||||
t.Set(0);
|
t.Set(0);
|
||||||
// TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit
|
// TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit
|
||||||
m_VideoBitrate = (10.0 * 8.0 * 184.0 * m_VideoPacketCount) / femonConfig.calcinterval;
|
m_VideoBitrate = (10.0 * 8.0 * 184.0 * m_VideoPacketCount) / femonConfig.calcinterval;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
class cFemonReceiver : public cReceiver, public cThread {
|
class cFemonReceiver : public cReceiver, public cThread {
|
||||||
private:
|
private:
|
||||||
cCondWait m_Sleep;
|
cCondWait m_Sleep;
|
||||||
|
bool m_Active;
|
||||||
|
|
||||||
int m_VideoPid;
|
int m_VideoPid;
|
||||||
int m_VideoPacketCount;
|
int m_VideoPacketCount;
|
||||||
@ -54,6 +55,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
cFemonReceiver(tChannelID ChannelID, int Ca, int Vpid, int Apid[], int Dpid[]);
|
cFemonReceiver(tChannelID ChannelID, int Ca, int Vpid, int Apid[], int Dpid[]);
|
||||||
virtual ~cFemonReceiver();
|
virtual ~cFemonReceiver();
|
||||||
|
void Deactivate(void);
|
||||||
|
|
||||||
bool VideoValid(void) { return m_VideoValid; }; // boolean
|
bool VideoValid(void) { return m_VideoValid; }; // boolean
|
||||||
double VideoBitrate(void) { return m_VideoBitrate; }; // bit/s
|
double VideoBitrate(void) { return m_VideoBitrate; }; // bit/s
|
||||||
|
Loading…
Reference in New Issue
Block a user