Code cleanup and optimization (thanks to Ville Skytt)

This commit is contained in:
Frank Schmirler 2011-11-21 13:03:06 +01:00
parent 20c931ac6d
commit ce1583a756
6 changed files with 4 additions and 30 deletions

View File

@ -197,3 +197,4 @@ Ville Skytt
for updating the outdated COPYING file and FSF address
for restricting VTP command RENR to liemikuutio patch < 1.32
for fixing memory and filedescriptor leaks in libdvbmpeg
for code cleanup and optimization

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
- code cleanup and optimization (thanks to Ville Skyttä)
- properly shutdown IGMP timeout handler thread when the plugin is stopped.
Fixes occasional segfaults on VDR exit.
- fixed memory leak in libdvbmpeg read_pes (thanks to Ville Skyttä)

View File

@ -388,10 +388,9 @@ int refill_buffy(Remux *rem)
while ( acount > MAX_PLENGTH && vcount > MAX_PLENGTH && count < 10){
int neof;
count++;
init_pes(&pes);
if ((neof = read_pes(fin,&pes)) <= 0) return -1;
if (read_pes(fin,&pes) <= 0) return -1;
switch(pes.stream_id){
case AUDIO_STREAM_S ... AUDIO_STREAM_E:
rem->apes++;
@ -702,22 +701,6 @@ void init_remux(Remux *rem, int fin, int fout, int mult)
rem->time_off = 0;
}
uint32_t bytes2pts(int bytes, int rate)
{
if (bytes < 0xFFFFFFFFUL/720000UL)
return (uint32_t)(bytes*720000UL/rate);
else
return (uint32_t)(bytes/rate*720000UL);
}
long pts2bytes( uint32_t pts, int rate)
{
if (pts < 0xEFFFFFFFUL/rate)
return (pts*rate/720000);
else
return (pts* (rate/720000));
}
int write_audio_pes( Remux *rem, uint8_t *buf, int *alength)
{
int add;
@ -1088,12 +1071,6 @@ struct remux_s{
} REMUX;
void init_REMUX(REMUX *rem)
{
rem->num_pbuf = 0;
}
#define REPACK 2048
#define ABUF_SIZE REPACK*1024

View File

@ -192,9 +192,8 @@ int ring_read_file(ringbuffy *rbuf, int fd, int count)
}
int ring_rest(ringbuffy *rbuf){
int diff, free, pos, rest;
int diff, free, pos;
pos = rbuf->read_pos;
rest = rbuf->size - pos;
diff = rbuf->write_pos - pos;
free = (diff >= 0) ? diff : rbuf->size+diff;

View File

@ -281,7 +281,6 @@ cDevice* cServerConnection::CheckDevice(const cChannel *Channel, int Priority, b
return NULL; // no CAM is able to decrypt this channel
}
bool NeedsDetachReceivers = false;
cDevice *d = NULL;
//cCamSlot *s = NULL;
@ -335,7 +334,6 @@ cDevice* cServerConnection::CheckDevice(const cChannel *Channel, int Priority, b
// This device has less impact than any previous one, so we take it.
Impact = imp;
d = device;
NeedsDetachReceivers = ndr;
}
}
}

View File

@ -228,8 +228,6 @@ bool cConnectionHTTP::ProcessRequest(void)
void cConnectionHTTP::Flushed(void)
{
std::string line;
if (m_Status != hsBody)
return;