7 #include "packager/media/formats/webvtt/text_padder.h"
11 #include "packager/status_macros.h"
16 const uint64_t kStreamIndex = 0;
20 : zero_start_bias_ms_(zero_start_bias_ms) {}
22 Status TextPadder::InitializeInternal() {
26 Status TextPadder::Process(std::unique_ptr<StreamData> data) {
27 DCHECK_EQ(data->stream_index, kStreamIndex);
28 const bool is_text_sample =
29 data->stream_data_type == StreamDataType::kTextSample;
30 return is_text_sample ? OnTextSample(std::move(data))
34 Status TextPadder::OnTextSample(std::unique_ptr<StreamData> data) {
35 const TextSample& sample = *data->text_sample;
39 if (max_end_time_ms_ < 0) {
41 sample.start_time() > zero_start_bias_ms_ ? sample.start_time() : 0;
47 if (sample.start_time() > max_end_time_ms_) {
48 const std::string kNoId =
"";
49 auto filler = std::make_shared<TextSample>(kNoId, max_end_time_ms_,
51 TextSettings{}, TextFragment{});
56 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.