7 #include <packager/media/formats/mp4/composition_offset_iterator.h>
9 #include <absl/log/check.h>
10 #include <absl/log/log.h>
19 composition_offset_table_(composition_time_to_sample.composition_offset),
20 iterator_(composition_offset_table_.begin()) {}
21 CompositionOffsetIterator::~CompositionOffsetIterator() {}
25 if (sample_index_ >= iterator_->sample_count) {
27 if (iterator_ == composition_offset_table_.end())
35 return iterator_ != composition_offset_table_.end() &&
36 sample_index_ < iterator_->sample_count;
40 uint32_t current_sample = 0;
41 std::vector<CompositionOffset>::const_iterator it =
42 composition_offset_table_.begin();
43 for (; it != composition_offset_table_.end(); ++it) {
44 current_sample += it->sample_count;
45 if (current_sample >= sample)
46 return it->sample_offset;
48 DCHECK_LE(sample, current_sample) <<
" Sample is invalid";
53 uint32_t num_samples = 0;
54 std::vector<CompositionOffset>::const_iterator it =
55 composition_offset_table_.begin();
56 for (; it != composition_offset_table_.end(); ++it) {
57 num_samples += it->sample_count;
All the methods that are virtual are virtual for mocking.