Skip to content

Commit

Permalink
fix: PR feedback, segment check for mp4 outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
lee.fordyce committed Feb 22, 2024
1 parent 11791c4 commit c786a86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions packager/live_packager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ Status LivePackager::PackageTimedText(const Segment& in,
shaka::PackagingParams packaging_params;
packaging_params.chunking_params.segment_duration_in_seconds =
DEFAULT_SEGMENT_DURATION;
packaging_params.mp4_output_params.sequence_number = config_.segment_number;

packaging_params.mp4_output_params.include_pssh_in_stream = false;

Expand Down
31 changes: 16 additions & 15 deletions packager/live_packager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ void CheckVideoInitSegment(const FullSegmentBuffer& buffer,
}
}

void CheckSegment(const LiveConfig& config, const FullSegmentBuffer& buffer) {
void CheckSegment(const LiveConfig& config,
const FullSegmentBuffer& buffer,
const uint32_t expected_timescale) {
bool err(true);
size_t bytes_to_read(buffer.SegmentSize());
const uint8_t* data(buffer.SegmentData());
Expand All @@ -315,7 +317,7 @@ void CheckSegment(const LiveConfig& config, const FullSegmentBuffer& buffer) {
EXPECT_FALSE(err);

media::mp4::SegmentIndex expected;
expected.timescale = 10000000;
expected.timescale = expected_timescale;
SegmentIndexBoxChecker checker(expected);
checker.Check(reader.get());

Expand Down Expand Up @@ -800,7 +802,7 @@ TEST_F(LivePackagerBaseTest, CustomMoofSequenceNumber) {
ASSERT_EQ(Status::OK, packager.Package(init_seg, media_seg, out));
ASSERT_GT(out.SegmentSize(), 0);

CheckSegment(live_config, out);
CheckSegment(live_config, out, 10000000);
}
}

Expand Down Expand Up @@ -952,17 +954,7 @@ struct TimedTextTestCase {

class TimedTextParameterizedTest
: public LivePackagerBaseTest,
public ::testing::WithParamInterface<TimedTextTestCase> {
void SetUp() override {
LivePackagerBaseTest::SetUp();

LiveConfig live_config;
live_config.format = GetParam().output_format;
live_config.track_type = GetParam().track_type;
live_config.protection_scheme = LiveConfig::EncryptionScheme::NONE;
SetupLivePackagerConfig(live_config);
}
};
public ::testing::WithParamInterface<TimedTextTestCase> {};

TEST_P(TimedTextParameterizedTest, VerifyTimedText) {
for (unsigned int i = 0; i < kNumSegments; i++) {
Expand All @@ -979,10 +971,20 @@ TEST_P(TimedTextParameterizedTest, VerifyTimedText) {
SegmentData media_seg(segment_buffer.data(), segment_buffer.size());
FullSegmentBuffer out;

LiveConfig live_config;
live_config.protection_scheme = LiveConfig::EncryptionScheme::NONE;
live_config.format = GetParam().output_format;
live_config.track_type = GetParam().track_type;
live_config.segment_number = i + 1;
SetupLivePackagerConfig(live_config);
ASSERT_EQ(GetParam().expected_status,
live_packager_->PackageTimedText(media_seg, out));
if (GetParam().expected_status == Status::OK) {
ASSERT_GT(out.SegmentSize(), 0);
if (live_config.format == LiveConfig::OutputFormat::VTTMP4 ||
live_config.format == LiveConfig::OutputFormat::TTMLMP4) {
CheckSegment(live_config, out, 1000);
}
}
}
}
Expand Down Expand Up @@ -1026,5 +1028,4 @@ INSTANTIATE_TEST_CASE_P(
LiveConfig::OutputFormat::TTMLMP4,
Status(error::INVALID_ARGUMENT, "Stream not available"),
}));

} // namespace shaka

0 comments on commit c786a86

Please sign in to comment.