Skip to content

Commit

Permalink
IPTV HLS Fix divide by zero
Browse files Browse the repository at this point in the history
Fix divide by zero when segment length is zero or not known.
Result only used in log message so no functional change.
  • Loading branch information
kmdewaal committed Dec 29, 2024
1 parent 81bc4da commit 3a723e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,10 @@ int HLSReader::DownloadSegmentData(MythSingleDownload& downloader,
/* bits/sec */
bandwidth = 8ULL * 1000 * segment_len / downloadduration.count();
hls->AverageBandwidth(bandwidth);
hls->SetCurrentByteRate(segment_len/segment.Duration().count());
if (segment.Duration() > 0s)
{
hls->SetCurrentByteRate(segment_len/segment.Duration().count());
}

LOG(VB_RECORD, (m_debug ? LOG_INFO : LOG_DEBUG), LOC +
QString("%1 took %2ms for %3 bytes: bandwidth:%4KiB/s byterate:%5KiB/s")
Expand Down

0 comments on commit 3a723e9

Please sign in to comment.