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) {
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 std::shared_ptr<TextSample> filler = std::make_shared<TextSample>();
49 filler->SetTime(max_end_time_ms_, sample.start_time());
54 max_end_time_ms_ = std::max(max_end_time_ms_, sample.EndTime());
All the methods that are virtual are virtual for mocking.
TextPadder(int64_t zero_start_bias_ms)