7 #include <packager/media/formats/webvtt/text_padder.h>
11 #include <absl/log/check.h>
13 #include <packager/macros/status.h>
18 const uint64_t kStreamIndex = 0;
22 : zero_start_bias_ms_(zero_start_bias_ms) {}
24 Status TextPadder::InitializeInternal() {
28 Status TextPadder::Process(std::unique_ptr<StreamData> data) {
29 DCHECK_EQ(data->stream_index, kStreamIndex);
30 const bool is_text_sample =
31 data->stream_data_type == StreamDataType::kTextSample;
32 return is_text_sample ? OnTextSample(std::move(data))
36 Status TextPadder::OnTextSample(std::unique_ptr<StreamData> data) {
37 const TextSample& sample = *data->text_sample;
41 if (max_end_time_ms_ < 0) {
43 zero_start_bias_ms_ && sample.start_time() > zero_start_bias_ms_
51 if (sample.start_time() > max_end_time_ms_) {
52 const std::string kNoId =
"";
53 auto filler = std::make_shared<TextSample>(kNoId, max_end_time_ms_,
55 TextSettings{}, TextFragment{});
60 max_end_time_ms_ = std::max(max_end_time_ms_, sample.EndTime());
TextPadder(int64_t zero_start_bias_ms)
All the methods that are virtual are virtual for mocking.