Feature #5393

Maximize use of libdvbcsa's batch processing.

Added by Joe User 8 months ago. Updated 8 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


The batch mode processing of libdvbcsa has a maximum number of packets it can descramble in one pass and according to the documentation:

Arrays with less entries  than the maximum batch size will take
the _same_ time to process as a full batch array.

So, for best performance, the array should be filled with the maximum number of packets. The csa_tbscluster is created with the maximum size, but, since unscrambled packets are also sent through the descrambler, the csa_tsbcluster ends up containing less then the maximum number of scrambled packets. I was seeing as much as 20% of the csa_tsbcluster filled with unscrambled packets for regular channels and as much as 60% unscrambled packets for radio only channels. So, I increased the size of the csa_tsbcluster (3X) and individually track how many even and odd scrambled packets are put in the buffer and only call the flush when either the even or odd count reaches the maximum, or the (enlarged) csa_tsbcluster is full.

I also renamed the unused "csa" subsystem to "tvhcsa" (since it does more than just csa now) and added some traces to show the fill levels.


[  TRACE] tvhcsa: 0x7f3a70004dc0: service "SERVICE" using CSA batch size = 128 for decryption

[  TRACE] tvhcsa: 0x7f3a70004dc0: CSA flush - descramble packets for service "SERVICE"  MAX=128  even=128  odd=0   fill=152

[  TRACE] tvhcsa: 0x7f3a70005280: service "RADIO SERVICE" using CSA batch size = 128 for decryption

[  TRACE] tvhcsa: 0x7f3a70005280: CSA flush - descramble packets for service "RADIO SERVICE"  MAX=128  even=128  odd=0   fill=265

The pull request is here:




Updated by Jaroslav Kysela 8 months ago

Added in latest.


Updated by Jaroslav Kysela 8 months ago

  • Status changed from New to Fixed

Also available in: Atom PDF