Optimized receiver thread termination.

This commit is contained in:
Rolf Ahrenberg 2008-09-10 17:37:28 +03:00
parent 0b19b7b31d
commit 1570cf80f8
3 changed files with 39 additions and 36 deletions

View File

@ -302,3 +302,4 @@ VDR Plugin 'femon' Revision History
2008-xx-xx: Version 1.6.2 2008-xx-xx: Version 1.6.2
- Converted HISTORY and fi_FI.po to UTF-8. - Converted HISTORY and fi_FI.po to UTF-8.
- Optimized receiver thread termination.

View File

@ -58,6 +58,7 @@ 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__);
m_Sleep.Signal();
if (Running()) if (Running())
Cancel(3); Cancel(3);
Detach(); Detach();
@ -362,6 +363,6 @@ void cFemonReceiver::Action(void)
m_AudioPacketCount = 0; m_AudioPacketCount = 0;
m_AC3Bitrate = (10.0 * 8.0 * 184.0 * m_AC3PacketCount) / femonConfig.calcinterval; m_AC3Bitrate = (10.0 * 8.0 * 184.0 * m_AC3PacketCount) / femonConfig.calcinterval;
m_AC3PacketCount = 0; m_AC3PacketCount = 0;
cCondWait::SleepMs(100 * femonConfig.calcinterval - t.Elapsed()); m_Sleep.Wait(max((int)(100 * femonConfig.calcinterval - t.Elapsed()), 3));
} }
} }

View File

@ -47,7 +47,7 @@ enum eDolbySurroundMode {
DSM_RESERVED = 3, DSM_RESERVED = 3,
}; };
enum eReveiverCodes { enum eReceiverCodes {
FR_RESERVED = -1, FR_RESERVED = -1,
FR_FREE = -2, FR_FREE = -2,
FR_NOTVALID = -3 FR_NOTVALID = -3
@ -55,40 +55,41 @@ enum eReveiverCodes {
class cFemonReceiver : public cReceiver, public cThread { class cFemonReceiver : public cReceiver, public cThread {
private: private:
int m_VideoPid; cCondWait m_Sleep;
int m_AudioPid; int m_VideoPid;
int m_AC3Pid; int m_AudioPid;
bool m_VideoValid; int m_AC3Pid;
int m_VideoPacketCount; bool m_VideoValid;
int m_VideoHorizontalSize; int m_VideoPacketCount;
int m_VideoVerticalSize; int m_VideoHorizontalSize;
int m_VideoAspectRatio; int m_VideoVerticalSize;
int m_VideoFormat; int m_VideoAspectRatio;
double m_VideoFrameRate; int m_VideoFormat;
double m_VideoStreamBitrate; double m_VideoFrameRate;
double m_VideoBitrate; double m_VideoStreamBitrate;
bool m_AudioValid; double m_VideoBitrate;
int m_AudioPacketCount; bool m_AudioValid;
double m_AudioStreamBitrate; int m_AudioPacketCount;
double m_AudioBitrate; double m_AudioStreamBitrate;
int m_AudioSamplingFreq; double m_AudioBitrate;
int m_AudioMPEGLayer; int m_AudioSamplingFreq;
bool m_AC3Valid; int m_AudioMPEGLayer;
int m_AC3PacketCount; bool m_AC3Valid;
double m_AC3Bitrate; int m_AC3PacketCount;
int m_AC3FrameSize; double m_AC3Bitrate;
int m_AC3SamplingFreq; int m_AC3FrameSize;
int m_AC3StreamBitrate; int m_AC3SamplingFreq;
int m_AC3BitStreamMode; int m_AC3StreamBitrate;
int m_AC3AudioCodingMode; int m_AC3BitStreamMode;
int m_AC3CenterMixLevel; int m_AC3AudioCodingMode;
int m_AC3SurroundMixLevel; int m_AC3CenterMixLevel;
int m_AC3DolbySurroundMode; int m_AC3SurroundMixLevel;
bool m_AC3LfeOn; int m_AC3DolbySurroundMode;
int m_AC3DialogLevel; bool m_AC3LfeOn;
void GetVideoInfo(uint8_t *mbuf, int count); int m_AC3DialogLevel;
void GetAudioInfo(uint8_t *mbuf, int count); void GetVideoInfo(uint8_t *mbuf, int count);
void GetAC3Info(uint8_t *mbuf, int count); void GetAudioInfo(uint8_t *mbuf, int count);
void GetAC3Info(uint8_t *mbuf, int count);
protected: protected:
virtual void Activate(bool On); virtual void Activate(bool On);