Changeset 11569


Ignore:
Timestamp:
Nov 7, 2019, 8:09:47 PM (11 days ago)
Author:
theparasol
Message:

Attempt to count descramblers used properly

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-dvbapi.c

    r11568 r11569  
    25632563    demux[demux_id].pidindex = -1;
    25642564    demux[demux_id].curindex = -1;
    2565     if(ca_descramblers_used > 0) // it should never go below 0, but you never know
    2566     {
    2567         ca_descramblers_used--; // decrease number of used descramblers
    2568     }
    2569 
     2565   
    25702566    if(!cfg.dvbapi_listenport && cfg.dvbapi_boxtype != BOXTYPE_PC_NODMX)
    25712567    {
     
    87038699                    ll_iter_remove_data(&itr);
    87048700                    cs_log_dbg(D_DVBAPI, "Removed last indexer of streampid %04X from ca%d", pid, cadevice);
     8701                    ca_descramblers_used = count_active_indexers();
    87058702                    return REMOVED_STREAMPID_LASTINDEX;
    87068703                }
     
    89858982    }
    89868983    return INDEX_INVALID; // no indexer found for this pid!
     8984}
     8985
     8986uint32_t count_active_indexers(void)
     8987{
     8988    struct s_streampid *listitem;
     8989    LL_ITER itr;
     8990    if(!ll_activestreampids)
     8991    {
     8992        return 0;
     8993    }
     8994
     8995    bool indexer_in_use[ca_descramblers_total];
     8996    memset(&indexer_in_use, 0, sizeof(indexer_in_use));
     8997   
     8998    uint32_t usecounter = 0;
     8999    if(ll_count(ll_activestreampids) > 0)
     9000    {
     9001        itr = ll_iter_create(ll_activestreampids);
     9002        while((listitem = ll_iter_next(&itr)))
     9003        {   
     9004            if(listitem->caindex != INDEX_INVALID && listitem->caindex < INDEX_MAX)
     9005            {
     9006                indexer_in_use[listitem->caindex] = true;
     9007            }
     9008        }
     9009        uint32_t i = 0;
     9010        for(i = 0; i < ca_descramblers_total; i++)
     9011        {
     9012            if(indexer_in_use[i] == true)
     9013            {
     9014                usecounter++;
     9015            }
     9016        }
     9017    }
     9018   
     9019    return usecounter;
    89879020}
    89889021
  • trunk/module-dvbapi.h

    r11556 r11569  
    512512void disable_unused_streampids(int16_t demux_id);
    513513uint32_t is_ca_used(uint8_t cadevice, int32_t pid);
     514uint32_t count_active_indexers(void);
    514515uint16_t dvbapi_get_client_proto_version(void);
    515516const char *dvbapi_get_client_name(void);
Note: See TracChangeset for help on using the changeset viewer.