Skip to content

Commit

Permalink
Merge pull request #1320 from CastagnaIT/fix_segcount_nexus
Browse files Browse the repository at this point in the history
[backport][DASHTree] Dont force rounding segment count
  • Loading branch information
CastagnaIT authored Jul 9, 2023
2 parents 9b2d112 + f2e9648 commit e1e6cfb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/parser/DASHTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "PRProtectionParser.h"
#include "kodi/tools/StringUtils.h"

#include <cmath>
#include <cstring>
#include <float.h>
#include <string>
Expand Down Expand Up @@ -1251,9 +1252,8 @@ static void XMLCALL end(void* data, const char* el)
if (countSegs == 0)
{
countSegs =
static_cast<size_t>(static_cast<double>(overallSeconds) /
(static_cast<double>(tpl.duration) / tpl.timescale)) +
1;
static_cast<size_t>(std::ceil(static_cast<double>(overallSeconds) /
(static_cast<double>(tpl.duration) / tpl.timescale)));
}

if (countSegs < 65536)
Expand Down
8 changes: 4 additions & 4 deletions src/test/TestDASHTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ TEST_F(DASHTreeTest, CalculateCorrectSegmentNumbersFromSegmentTemplateWithPTO)
adaptive::SPINCACHE<adaptive::AdaptiveTree::Segment> segments =
tree->periods_[0]->adaptationSets_[0]->representations_[0]->segments_;

EXPECT_EQ(segments.size(), 451);
EXPECT_EQ(segments.size(), 450);
EXPECT_EQ(segments.Get(0)->range_end_, 404305525);
EXPECT_EQ(segments.Get(450)->range_end_, 404305975);
EXPECT_EQ(segments.Get(449)->range_end_, 404305974);
}

TEST_F(DASHTreeTest, CalculateCorrectSegmentNumbersFromSegmentTemplateWithOldPublishTime)
Expand All @@ -249,9 +249,9 @@ TEST_F(DASHTreeTest, CalculateCorrectSegmentNumbersFromSegmentTemplateWithOldPub
adaptive::SPINCACHE<adaptive::AdaptiveTree::Segment> segments =
tree->periods_[0]->adaptationSets_[0]->representations_[0]->segments_;

EXPECT_EQ(segments.size(), 31);
EXPECT_EQ(segments.size(), 30);
EXPECT_EQ(segments.Get(0)->range_end_, 603272);
EXPECT_EQ(segments.Get(30)->range_end_, 603302);
EXPECT_EQ(segments.Get(29)->range_end_, 603301);
}

TEST_F(DASHTreeTest, CalculateLiveWithPresentationDuration)
Expand Down

0 comments on commit e1e6cfb

Please sign in to comment.