Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jedekar committed Mar 27, 2024
1 parent a3fce8f commit f333da9
Showing 1 changed file with 40 additions and 39 deletions.
79 changes: 40 additions & 39 deletions packager/live_packager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,45 +314,46 @@ void CheckVideoInitSegment(const SegmentBuffer& buffer,
}
}

void CheckTextInitSegment(const FullSegmentBuffer& buffer,
media::FourCC handler,
media::FourCC format) {
bool err(true);
size_t bytes_to_read(buffer.InitSegmentSize());
const uint8_t* data(buffer.InitSegmentData());

{
std::unique_ptr<media::mp4::BoxReader> reader(
media::mp4::BoxReader::ReadBox(data, bytes_to_read, &err));
EXPECT_FALSE(err);

FileTypeBoxChecker checker;
checker.Check(reader.get());

data += reader->size();
bytes_to_read -= reader->size();
}

{
std::unique_ptr<media::mp4::BoxReader> reader(
media::mp4::BoxReader::ReadBox(data, bytes_to_read, &err));
EXPECT_FALSE(err);

media::mp4::TextSampleEntry entry;
entry.format = format;

media::mp4::Track track;
track.media.handler.handler_type = handler;
track.media.information.sample_table.description.text_entries.push_back(
entry);

media::mp4::Movie expected;
expected.tracks.push_back(track);

MovieBoxChecker checker(expected);
checker.Check(reader.get());
}
}
// TODO(sasha): must be used when PackageTimedTextInit is added.
// void CheckTextInitSegment(const FullSegmentBuffer& buffer,
// media::FourCC handler,
// media::FourCC format) {
// bool err(true);
// size_t bytes_to_read(buffer.InitSegmentSize());
// const uint8_t* data(buffer.InitSegmentData());
//
// {
// std::unique_ptr<media::mp4::BoxReader> reader(
// media::mp4::BoxReader::ReadBox(data, bytes_to_read, &err));
// EXPECT_FALSE(err);
//
// FileTypeBoxChecker checker;
// checker.Check(reader.get());
//
// data += reader->size();
// bytes_to_read -= reader->size();
// }
//
// {
// std::unique_ptr<media::mp4::BoxReader> reader(
// media::mp4::BoxReader::ReadBox(data, bytes_to_read, &err));
// EXPECT_FALSE(err);
//
// media::mp4::TextSampleEntry entry;
// entry.format = format;
//
// media::mp4::Track track;
// track.media.handler.handler_type = handler;
// track.media.information.sample_table.description.text_entries.push_back(
// entry);
//
// media::mp4::Movie expected;
// expected.tracks.push_back(track);
//
// MovieBoxChecker checker(expected);
// checker.Check(reader.get());
// }
// }

void CheckSegment(const LiveConfig& config,
const SegmentBuffer& buffer,
Expand Down

0 comments on commit f333da9

Please sign in to comment.