Fixed sending CA descriptors to CAMs in case a cReceiver is not used for a recording or live view, like e.g. streaming clients

This commit is contained in:
Klaus Schmidinger 2014-01-14 14:39:59 +01:00
parent e7c86c6760
commit 1d869c4b36
3 changed files with 19 additions and 4 deletions

View File

@ -3237,3 +3237,7 @@ Thomas Reufer <thomas@reufer.ch>
for suggesting to add an additional parameter named Forward to cDevice::TrickSpeed() for suggesting to add an additional parameter named Forward to cDevice::TrickSpeed()
for suggesting to add a note to ePlayMode in device.h that VDR itself always uses for suggesting to add a note to ePlayMode in device.h that VDR itself always uses
pmAudioVideo when replaying a recording pmAudioVideo when replaying a recording
Mariusz Bialonczyk <manio@skyboo.net>
for fixing sending CA descriptors to CAMs in case a cReceiver is not used for a
recording or live view, like e.g. streaming clients

View File

@ -8140,3 +8140,5 @@ Video Disk Recorder Revision History
- Improved locking for CAM slots and made the pure functions of cCiAdapter have - Improved locking for CAM slots and made the pure functions of cCiAdapter have
default implementations, to fix a possible crash with CI adapters and CAM slots default implementations, to fix a possible crash with CI adapters and CAM slots
that are implemented in a plugin. that are implemented in a plugin.
- Fixed sending CA descriptors to CAMs in case a cReceiver is not used for a
recording or live view, like e.g. streaming clients (thanks to Mariusz Bialonczyk).

17
ci.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: ci.c 3.5 2014/01/14 12:03:37 kls Exp $ * $Id: ci.c 3.6 2014/01/14 14:36:29 kls Exp $
*/ */
#include "ci.h" #include "ci.h"
@ -592,6 +592,7 @@ private:
int transponder; int transponder;
int programNumber; int programNumber;
int caSystemIds[MAXCASYSTEMIDS + 1]; // list is zero terminated! int caSystemIds[MAXCASYSTEMIDS + 1]; // list is zero terminated!
bool gotCaDescriptors;
void AddCaDescriptors(int Length, const uint8_t *Data); void AddCaDescriptors(int Length, const uint8_t *Data);
public: public:
cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds); cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds);
@ -599,10 +600,12 @@ public:
void SetListManagement(uint8_t ListManagement); void SetListManagement(uint8_t ListManagement);
uint8_t ListManagement(void) { return capmt[0]; } uint8_t ListManagement(void) { return capmt[0]; }
void AddPid(int Pid, uint8_t StreamType); void AddPid(int Pid, uint8_t StreamType);
bool GotCaDescriptors(void) { return gotCaDescriptors; }
}; };
cCiCaPmt::cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds) cCiCaPmt::cCiCaPmt(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds)
{ {
gotCaDescriptors = false;
cmdId = CmdId; cmdId = CmdId;
source = Source; source = Source;
transponder = Transponder; transponder = Transponder;
@ -658,6 +661,7 @@ void cCiCaPmt::AddCaDescriptors(int Length, const uint8_t *Data)
int l = length - esInfoLengthPos - 2; int l = length - esInfoLengthPos - 2;
capmt[esInfoLengthPos] = (l >> 8) & 0xFF; capmt[esInfoLengthPos] = (l >> 8) & 0xFF;
capmt[esInfoLengthPos + 1] = l & 0xFF; capmt[esInfoLengthPos + 1] = l & 0xFF;
gotCaDescriptors = true;
} }
} }
else else
@ -1812,6 +1816,7 @@ cCiEnquiry *cCamSlot::GetEnquiry(void)
void cCamSlot::SendCaPmt(uint8_t CmdId) void cCamSlot::SendCaPmt(uint8_t CmdId)
{ {
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
bool needResend = false;
cCiConditionalAccessSupport *cas = (cCiConditionalAccessSupport *)GetSessionByResourceId(RI_CONDITIONAL_ACCESS_SUPPORT); cCiConditionalAccessSupport *cas = (cCiConditionalAccessSupport *)GetSessionByResourceId(RI_CONDITIONAL_ACCESS_SUPPORT);
if (cas) { if (cas) {
const int *CaSystemIds = cas->GetCaSystemIds(); const int *CaSystemIds = cas->GetCaSystemIds();
@ -1844,8 +1849,12 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
} }
if (cas->RepliesToQuery()) if (cas->RepliesToQuery())
CaPmt.SetListManagement(Active ? CPLM_ADD : CPLM_UPDATE); CaPmt.SetListManagement(Active ? CPLM_ADD : CPLM_UPDATE);
if (Active || cas->RepliesToQuery()) if (Active || cas->RepliesToQuery()) {
cas->SendPMT(&CaPmt); if ((CaPmt.ListManagement() == CPLM_ADD || CaPmt.ListManagement() == CPLM_ONLY) && !CaPmt.GotCaDescriptors())
needResend = true;
else
cas->SendPMT(&CaPmt);
}
p->modified = false; p->modified = false;
} }
} }
@ -1855,7 +1864,7 @@ void cCamSlot::SendCaPmt(uint8_t CmdId)
if (cDevice *d = Device()) if (cDevice *d = Device())
d->AttachReceiver(caPidReceiver); d->AttachReceiver(caPidReceiver);
} }
resendPmt = false; resendPmt = needResend;
} }
else { else {
cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL); cCiCaPmt CaPmt(CmdId, 0, 0, 0, NULL);