7 #include <packager/media/formats/mp4/decoding_time_iterator.h>
11 #include <absl/log/check.h>
12 #include <absl/log/log.h>
21 decoding_time_table_(decoding_time_to_sample.decoding_time),
22 iterator_(decoding_time_table_.begin()) {}
23 DecodingTimeIterator::~DecodingTimeIterator() {}
27 if (sample_index_ >= iterator_->sample_count) {
29 if (iterator_ == decoding_time_table_.end())
37 return iterator_ != decoding_time_table_.end() &&
38 sample_index_ < iterator_->sample_count;
42 uint32_t end_sample)
const {
43 DCHECK_LE(start_sample, end_sample);
44 uint32_t current_sample = 0;
45 uint32_t prev_sample = 0;
47 std::vector<DecodingTime>::const_iterator it = decoding_time_table_.begin();
48 for (; it != decoding_time_table_.end(); ++it) {
49 current_sample += it->sample_count;
50 if (current_sample >= start_sample) {
51 duration += (std::min(end_sample, current_sample) -
52 std::max(start_sample, prev_sample + 1) + 1) *
54 if (current_sample >= end_sample)
57 prev_sample = current_sample;
63 uint32_t num_samples = 0;
64 std::vector<DecodingTime>::const_iterator it = decoding_time_table_.begin();
65 for (; it != decoding_time_table_.end(); ++it) {
66 num_samples += it->sample_count;
All the methods that are virtual are virtual for mocking.