Calculation of Session Quality
Session Concept
By a session SmartCARE means the period of interaction between the subscriber device and the streaming server, limited to the following events:
Session start
- start playing a TV channel in Live mode,
- activation of the Time Shift or Pause Live function while watching a TV channel,
- start playing a VoD content.
Session end
- session termination with the start of a new one (for example, when switching to another channel or VoD content);
- session termination by timeout (for example, in case of sudden and long-term STB power outage);
- STB goes into standby mode.
Algorithm 1
This algorithm characterises session quality as the degree of network availability. That is, if the quality is less than 100%, video chunks take longer to load than their playback time. The calculation is performed based on statistical parameters came with the chunk loading events. The formula of the algorithm is as follows:
- If the client data is used (the CHUNK_LOADED events)
[Quality] = s / br / d * 100
where
s — Chunk size, in bytes converted to bits.
br — Chunk bitrate taken from the playlist, in bit/s.
d — Chunk loading duration, in ms converted to seconds.
If the chunk size is very small (< 1 kB), it indicates that a bitrate change event has occurred. Therefore, such a chunk is not taken into account when calculating quality. - If the server data is used (the SmartMEDIA streaming nginx servers log data)
[Quality] = (body_bytes_sent / content_bw) / request_time * 100
where
body_bytes_sent — Chunk size, in bytes converted to bits (nginx log field).
content_bw — Chunk bitrate taken from the playlist, in bit/s.
request_time — Chunk loading duration, in ms converted to seconds.
In case of subscriber have a fast network, the chunks can be loaded very fast and then request_time becomes very small. Therefore, quality values >100% are truncated to 100%.
If request_time = 0, it means the chunk size is too small. Therefore it is dropped from the quality calculation.
Average Session Quality
If any of the 3 event parameters is not filled, the event quality is assumed to be null, the calculation is unsuccessful. null and 0 does not affect the calculation of the average session quality. To accumulate delta the next event with all 3 parameters filled is awaited.
- The calculation of the entire session quality is based on the average weighted.
Example:
There were 100 events with successfully calculated quality during the session:
70 events — with a quality of 95%,
10 events — with a quality of 83%,
20 events — with a quality of 89%.
The session quality for these 100 events = (70*95 + 10*83 + 20*89) / 100 = 93%. - The entire session quality is recalculated with each new chunk loading event.
Algorithm 2
The calculation is based on the time of content viewing at the maximum bitrate. For each channel, the maximum possible bitrate from the SmartTUBE dictionary is selected. Following are 2 options for calculating:
- the received log contains the chunks’ size: % = SUM (size of all chunks with maximum viewing bitrate) / SUM (the size of all chunks) * 100;
- the received log does not contain the chunks’ size: % = (number of events with maximum viewing bitrate) / (number of events with bitrate specified) * 100;
- the following value is stored in the database: SUM (% of viewing time at maximum bitrate) / number of subscribers.
Algorithm 3
Calculation and updating of indicator values is made every minute based on 3 parameters contained in the SESSIONSTART and KEEPALIVE events from end-user devices:
- pdc — Pictures Displayed Count
- dec — Data Error Count (number of frames with errors)
- pdec — Picture Decoding Error Count (number of frames with decoding errors)
Calculation formula
- allInputFrameCnt = delta.pdc + delta.dec + delta.pdec
The number of all frames, where delta means using not the absolute value of the parameter, but the difference between the value of the current and the previous event. - ratioErrorToAllFrame = (delta.dec + delta.pdec) / allInputFrameCnt
The ratio of the error frames number to their total count. - ratioGoodToAllFrame = (1 – ratioErrorToAllFrame) * 100
Unrounded value of the session quality between events (%). - qualityByFrame = Math.round(ratioGoodToAllFrame)
Rounded value of the session quality between events (%).
Calculation example
1st KEEPALIVE event: pdc = 100, dec = 8, pdec = 1.
2nd (following) KEEPALIVE event: pdc = 120, dec = 8, pdec = 3.
- allInputFrameCnt = (120-100) + (8-8) + (3-1) = 20 + 0 + 2 = 22
- ratioErrorToAllFrame = (8-8) + (3-1) / 22 = 0 + 2 / 22 = 0.091
- ratioGoodToAllFrame = (1 – ratioErrorToAllFrame) * 100 = (1 – 0.091) * 100 = 0.909 * 100 = 90.9
- qualityByFrame = Math.round(ratioGoodToAllFrame)= 91
Additional conditions
If any of the 3 event parameters is not filled, the event quality is assumed to be null, the calculation is unsuccessful. null and 0 does not affect the calculation of the average session quality. To accumulate delta the next event with all three parameters filled is awaited.
- The calculation of the entire session quality is based on the average weighted.
Example:
There were 100 events with successfully calculated quality during the session:
70 events — with a quality of 95%,
10 events — with a quality of 83%,
20 events — with a quality of 89%.
The session quality for these 100 events = (70*95 + 10*83 + 20*89) / 100 = 93%. - The entire session quality is recalculated with each new event (see formula above).
- The calculation of the “Unicast/Multicast session quality” indicators for all active sessions is made in the same way, on the principle of arithmetic mean weighted.