Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / media / formats / mp4 / mp4_stream_parser.cc
blob326a1aa8b14deb66fe3cf03e124f901eaa12242e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/formats/mp4/mp4_stream_parser.h"
7 #include "base/callback_helpers.h"
8 #include "base/logging.h"
9 #include "base/time/time.h"
10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/stream_parser_buffer.h"
12 #include "media/base/text_track_config.h"
13 #include "media/base/video_decoder_config.h"
14 #include "media/base/video_util.h"
15 #include "media/formats/mp4/box_definitions.h"
16 #include "media/formats/mp4/box_reader.h"
17 #include "media/formats/mp4/es_descriptor.h"
18 #include "media/formats/mp4/rcheck.h"
19 #include "media/formats/mpeg/adts_constants.h"
21 namespace media {
22 namespace mp4 {
24 MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types,
25 bool has_sbr)
26 : state_(kWaitingForInit),
27 moof_head_(0),
28 mdat_tail_(0),
29 highest_end_offset_(0),
30 has_audio_(false),
31 has_video_(false),
32 audio_track_id_(0),
33 video_track_id_(0),
34 audio_object_types_(audio_object_types),
35 has_sbr_(has_sbr),
36 is_audio_track_encrypted_(false),
37 is_video_track_encrypted_(false),
38 num_top_level_box_skipped_(0) {
41 MP4StreamParser::~MP4StreamParser() {}
43 void MP4StreamParser::Init(
44 const InitCB& init_cb,
45 const NewConfigCB& config_cb,
46 const NewBuffersCB& new_buffers_cb,
47 bool /* ignore_text_tracks */,
48 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
49 const NewMediaSegmentCB& new_segment_cb,
50 const base::Closure& end_of_segment_cb,
51 const scoped_refptr<MediaLog>& media_log) {
52 DCHECK_EQ(state_, kWaitingForInit);
53 DCHECK(init_cb_.is_null());
54 DCHECK(!init_cb.is_null());
55 DCHECK(!config_cb.is_null());
56 DCHECK(!new_buffers_cb.is_null());
57 DCHECK(!encrypted_media_init_data_cb.is_null());
58 DCHECK(!end_of_segment_cb.is_null());
60 ChangeState(kParsingBoxes);
61 init_cb_ = init_cb;
62 config_cb_ = config_cb;
63 new_buffers_cb_ = new_buffers_cb;
64 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
65 new_segment_cb_ = new_segment_cb;
66 end_of_segment_cb_ = end_of_segment_cb;
67 media_log_ = media_log;
70 void MP4StreamParser::Reset() {
71 queue_.Reset();
72 runs_.reset();
73 moof_head_ = 0;
74 mdat_tail_ = 0;
77 void MP4StreamParser::Flush() {
78 DCHECK_NE(state_, kWaitingForInit);
79 Reset();
80 ChangeState(kParsingBoxes);
83 bool MP4StreamParser::Parse(const uint8* buf, int size) {
84 DCHECK_NE(state_, kWaitingForInit);
86 if (state_ == kError)
87 return false;
89 queue_.Push(buf, size);
91 BufferQueue audio_buffers;
92 BufferQueue video_buffers;
94 bool result = false;
95 bool err = false;
97 do {
98 switch (state_) {
99 case kWaitingForInit:
100 case kError:
101 NOTREACHED();
102 return false;
104 case kParsingBoxes:
105 result = ParseBox(&err);
106 break;
108 case kWaitingForSampleData:
109 result = HaveEnoughDataToEnqueueSamples();
110 if (result)
111 ChangeState(kEmittingSamples);
112 break;
114 case kEmittingSamples:
115 result = EnqueueSample(&audio_buffers, &video_buffers, &err);
116 if (result) {
117 int64 max_clear = runs_->GetMaxClearOffset() + moof_head_;
118 err = !ReadAndDiscardMDATsUntil(max_clear);
120 break;
122 } while (result && !err);
124 if (!err)
125 err = !SendAndFlushSamples(&audio_buffers, &video_buffers);
127 if (err) {
128 DLOG(ERROR) << "Error while parsing MP4";
129 moov_.reset();
130 Reset();
131 ChangeState(kError);
132 return false;
135 return true;
138 bool MP4StreamParser::ParseBox(bool* err) {
139 const uint8* buf;
140 int size;
141 queue_.Peek(&buf, &size);
142 if (!size) return false;
144 scoped_ptr<BoxReader> reader(
145 BoxReader::ReadTopLevelBox(buf, size, media_log_, err));
146 if (reader.get() == NULL) return false;
148 if (reader->type() == FOURCC_MOOV) {
149 *err = !ParseMoov(reader.get());
150 } else if (reader->type() == FOURCC_MOOF) {
151 moof_head_ = queue_.head();
152 *err = !ParseMoof(reader.get());
154 // Set up first mdat offset for ReadMDATsUntil().
155 mdat_tail_ = queue_.head() + reader->size();
157 // Return early to avoid evicting 'moof' data from queue. Auxiliary info may
158 // be located anywhere in the file, including inside the 'moof' itself.
159 // (Since 'default-base-is-moof' is mandated, no data references can come
160 // before the head of the 'moof', so keeping this box around is sufficient.)
161 return !(*err);
162 } else {
163 // TODO(wolenetz,chcunningham): Enforce more strict adherence to MSE byte
164 // stream spec for ftyp and styp. See http://crbug.com/504514.
165 DVLOG(2) << "Skipping unrecognized top-level box: "
166 << FourCCToString(reader->type());
169 queue_.Pop(reader->size());
170 return !(*err);
173 bool MP4StreamParser::ParseMoov(BoxReader* reader) {
174 moov_.reset(new Movie);
175 RCHECK(moov_->Parse(reader));
176 runs_.reset();
178 has_audio_ = false;
179 has_video_ = false;
181 AudioDecoderConfig audio_config;
182 VideoDecoderConfig video_config;
184 for (std::vector<Track>::const_iterator track = moov_->tracks.begin();
185 track != moov_->tracks.end(); ++track) {
186 // TODO(strobe): Only the first audio and video track present in a file are
187 // used. (Track selection is better accomplished via Source IDs, though, so
188 // adding support for track selection within a stream is low-priority.)
189 const SampleDescription& samp_descr =
190 track->media.information.sample_table.description;
192 // TODO(strobe): When codec reconfigurations are supported, detect and send
193 // a codec reconfiguration for fragments using a sample description index
194 // different from the previous one
195 size_t desc_idx = 0;
196 for (size_t t = 0; t < moov_->extends.tracks.size(); t++) {
197 const TrackExtends& trex = moov_->extends.tracks[t];
198 if (trex.track_id == track->header.track_id) {
199 desc_idx = trex.default_sample_description_index;
200 break;
203 RCHECK(desc_idx > 0);
204 desc_idx -= 1; // BMFF descriptor index is one-based
206 if (track->media.handler.type == kAudio && !audio_config.IsValidConfig()) {
207 RCHECK(!samp_descr.audio_entries.empty());
209 // It is not uncommon to find otherwise-valid files with incorrect sample
210 // description indices, so we fail gracefully in that case.
211 if (desc_idx >= samp_descr.audio_entries.size())
212 desc_idx = 0;
213 const AudioSampleEntry& entry = samp_descr.audio_entries[desc_idx];
214 const AAC& aac = entry.esds.aac;
216 if (!(entry.format == FOURCC_MP4A ||
217 (entry.format == FOURCC_ENCA &&
218 entry.sinf.format.format == FOURCC_MP4A))) {
219 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio format 0x"
220 << std::hex << entry.format
221 << " in stsd box.";
222 return false;
225 uint8 audio_type = entry.esds.object_type;
226 DVLOG(1) << "audio_type " << std::hex << static_cast<int>(audio_type);
227 if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
228 MEDIA_LOG(ERROR, media_log_)
229 << "audio object type 0x" << std::hex << audio_type
230 << " does not match what is specified in the"
231 << " mimetype.";
232 return false;
235 AudioCodec codec = kUnknownAudioCodec;
236 ChannelLayout channel_layout = CHANNEL_LAYOUT_NONE;
237 int sample_per_second = 0;
238 std::vector<uint8> extra_data;
239 // Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or
240 // supported MPEG2 AAC varients.
241 if (ESDescriptor::IsAAC(audio_type)) {
242 codec = kCodecAAC;
243 channel_layout = aac.GetChannelLayout(has_sbr_);
244 sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_);
245 #if defined(OS_ANDROID)
246 extra_data = aac.codec_specific_data();
247 #endif
248 } else {
249 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio object type 0x"
250 << std::hex << audio_type << " in esds.";
251 return false;
254 SampleFormat sample_format;
255 if (entry.samplesize == 8) {
256 sample_format = kSampleFormatU8;
257 } else if (entry.samplesize == 16) {
258 sample_format = kSampleFormatS16;
259 } else if (entry.samplesize == 32) {
260 sample_format = kSampleFormatS32;
261 } else {
262 LOG(ERROR) << "Unsupported sample size.";
263 return false;
266 is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
267 DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_;
268 audio_config.Initialize(
269 codec, sample_format, channel_layout, sample_per_second,
270 extra_data.size() ? &extra_data[0] : NULL, extra_data.size(),
271 is_audio_track_encrypted_, false, base::TimeDelta(),
273 has_audio_ = true;
274 audio_track_id_ = track->header.track_id;
276 if (track->media.handler.type == kVideo && !video_config.IsValidConfig()) {
277 RCHECK(!samp_descr.video_entries.empty());
278 if (desc_idx >= samp_descr.video_entries.size())
279 desc_idx = 0;
280 const VideoSampleEntry& entry = samp_descr.video_entries[desc_idx];
282 if (!entry.IsFormatValid()) {
283 MEDIA_LOG(ERROR, media_log_) << "Unsupported video format 0x"
284 << std::hex << entry.format
285 << " in stsd box.";
286 return false;
289 // TODO(strobe): Recover correct crop box
290 gfx::Size coded_size(entry.width, entry.height);
291 gfx::Rect visible_rect(coded_size);
292 gfx::Size natural_size = GetNaturalSize(visible_rect.size(),
293 entry.pixel_aspect.h_spacing,
294 entry.pixel_aspect.v_spacing);
295 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
296 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_;
297 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, PIXEL_FORMAT_YV12,
298 COLOR_SPACE_HD_REC709, coded_size, visible_rect,
299 natural_size,
300 // No decoder-specific buffer needed for AVC;
301 // SPS/PPS are embedded in the video stream
302 NULL, 0, is_video_track_encrypted_, false);
303 has_video_ = true;
304 video_track_id_ = track->header.track_id;
308 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap()));
310 StreamParser::InitParameters params(kInfiniteDuration());
311 if (moov_->extends.header.fragment_duration > 0) {
312 params.duration = TimeDeltaFromRational(
313 moov_->extends.header.fragment_duration, moov_->header.timescale);
314 params.liveness = DemuxerStream::LIVENESS_RECORDED;
315 } else if (moov_->header.duration > 0 &&
316 moov_->header.duration != kuint64max) {
317 params.duration =
318 TimeDeltaFromRational(moov_->header.duration, moov_->header.timescale);
319 params.liveness = DemuxerStream::LIVENESS_RECORDED;
320 } else {
321 // In ISO/IEC 14496-12:2005(E), 8.30.2: ".. If an MP4 file is created in
322 // real-time, such as used in live streaming, it is not likely that the
323 // fragment_duration is known in advance and this (mehd) box may be
324 // omitted."
325 // TODO(wolenetz): Investigate gating liveness detection on timeline_offset
326 // when it's populated. See http://crbug.com/312699
327 params.liveness = DemuxerStream::LIVENESS_LIVE;
330 DVLOG(1) << "liveness: " << params.liveness;
332 if (!init_cb_.is_null())
333 base::ResetAndReturn(&init_cb_).Run(params);
335 if (!moov_->pssh.empty())
336 OnEncryptedMediaInitData(moov_->pssh);
338 return true;
341 bool MP4StreamParser::ParseMoof(BoxReader* reader) {
342 RCHECK(moov_.get()); // Must already have initialization segment
343 MovieFragment moof;
344 RCHECK(moof.Parse(reader));
345 if (!runs_)
346 runs_.reset(new TrackRunIterator(moov_.get(), media_log_));
347 RCHECK(runs_->Init(moof));
348 RCHECK(ComputeHighestEndOffset(moof));
350 if (!moof.pssh.empty())
351 OnEncryptedMediaInitData(moof.pssh);
353 new_segment_cb_.Run();
354 ChangeState(kWaitingForSampleData);
355 return true;
358 void MP4StreamParser::OnEncryptedMediaInitData(
359 const std::vector<ProtectionSystemSpecificHeader>& headers) {
360 // TODO(strobe): ensure that the value of init_data (all PSSH headers
361 // concatenated in arbitrary order) matches the EME spec.
362 // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17673.
363 size_t total_size = 0;
364 for (size_t i = 0; i < headers.size(); i++)
365 total_size += headers[i].raw_box.size();
367 std::vector<uint8> init_data(total_size);
368 size_t pos = 0;
369 for (size_t i = 0; i < headers.size(); i++) {
370 memcpy(&init_data[pos], &headers[i].raw_box[0],
371 headers[i].raw_box.size());
372 pos += headers[i].raw_box.size();
374 encrypted_media_init_data_cb_.Run(EmeInitDataType::CENC, init_data);
377 bool MP4StreamParser::PrepareAVCBuffer(
378 const AVCDecoderConfigurationRecord& avc_config,
379 std::vector<uint8>* frame_buf,
380 std::vector<SubsampleEntry>* subsamples) const {
381 // Convert the AVC NALU length fields to Annex B headers, as expected by
382 // decoding libraries. Since this may enlarge the size of the buffer, we also
383 // update the clear byte count for each subsample if encryption is used to
384 // account for the difference in size between the length prefix and Annex B
385 // start code.
386 RCHECK(AVC::ConvertFrameToAnnexB(avc_config.length_size, frame_buf));
387 if (!subsamples->empty()) {
388 const int nalu_size_diff = 4 - avc_config.length_size;
389 size_t expected_size = runs_->sample_size() +
390 subsamples->size() * nalu_size_diff;
391 RCHECK(frame_buf->size() == expected_size);
392 for (size_t i = 0; i < subsamples->size(); i++)
393 (*subsamples)[i].clear_bytes += nalu_size_diff;
396 if (runs_->is_keyframe()) {
397 // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of
398 // a frame. If subsample info is present, we also update the clear byte
399 // count for that first subsample.
400 RCHECK(AVC::InsertParamSetsAnnexB(avc_config, frame_buf, subsamples));
403 DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples));
404 return true;
407 bool MP4StreamParser::PrepareAACBuffer(
408 const AAC& aac_config, std::vector<uint8>* frame_buf,
409 std::vector<SubsampleEntry>* subsamples) const {
410 // Append an ADTS header to every audio sample.
411 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf));
413 // As above, adjust subsample information to account for the headers. AAC is
414 // not required to use subsample encryption, so we may need to add an entry.
415 if (subsamples->empty()) {
416 subsamples->push_back(SubsampleEntry(
417 kADTSHeaderMinSize, frame_buf->size() - kADTSHeaderMinSize));
418 } else {
419 (*subsamples)[0].clear_bytes += kADTSHeaderMinSize;
421 return true;
424 bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
425 BufferQueue* video_buffers,
426 bool* err) {
427 DCHECK_EQ(state_, kEmittingSamples);
429 if (!runs_->IsRunValid()) {
430 // Flush any buffers we've gotten in this chunk so that buffers don't
431 // cross NewSegment() calls
432 *err = !SendAndFlushSamples(audio_buffers, video_buffers);
433 if (*err)
434 return false;
436 // Remain in kEmittingSamples state, discarding data, until the end of
437 // the current 'mdat' box has been appended to the queue.
438 if (!queue_.Trim(mdat_tail_))
439 return false;
441 ChangeState(kParsingBoxes);
442 end_of_segment_cb_.Run();
443 return true;
446 if (!runs_->IsSampleValid()) {
447 runs_->AdvanceRun();
448 return true;
451 DCHECK(!(*err));
453 const uint8* buf;
454 int buf_size;
455 queue_.Peek(&buf, &buf_size);
456 if (!buf_size) return false;
458 bool audio = has_audio_ && audio_track_id_ == runs_->track_id();
459 bool video = has_video_ && video_track_id_ == runs_->track_id();
461 // Skip this entire track if it's not one we're interested in
462 if (!audio && !video) {
463 runs_->AdvanceRun();
464 return true;
467 // Attempt to cache the auxiliary information first. Aux info is usually
468 // placed in a contiguous block before the sample data, rather than being
469 // interleaved. If we didn't cache it, this would require that we retain the
470 // start of the segment buffer while reading samples. Aux info is typically
471 // quite small compared to sample data, so this pattern is useful on
472 // memory-constrained devices where the source buffer consumes a substantial
473 // portion of the total system memory.
474 if (runs_->AuxInfoNeedsToBeCached()) {
475 queue_.PeekAt(runs_->aux_info_offset() + moof_head_, &buf, &buf_size);
476 if (buf_size < runs_->aux_info_size()) return false;
477 *err = !runs_->CacheAuxInfo(buf, buf_size);
478 return !*err;
481 queue_.PeekAt(runs_->sample_offset() + moof_head_, &buf, &buf_size);
482 if (buf_size < runs_->sample_size()) return false;
484 scoped_ptr<DecryptConfig> decrypt_config;
485 std::vector<SubsampleEntry> subsamples;
486 if (runs_->is_encrypted()) {
487 decrypt_config = runs_->GetDecryptConfig();
488 if (!decrypt_config) {
489 *err = true;
490 return false;
492 subsamples = decrypt_config->subsamples();
495 std::vector<uint8> frame_buf(buf, buf + runs_->sample_size());
496 if (video) {
497 if (!PrepareAVCBuffer(runs_->video_description().avcc,
498 &frame_buf, &subsamples)) {
499 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AVC sample for decode";
500 *err = true;
501 return false;
505 if (audio) {
506 if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) &&
507 !PrepareAACBuffer(runs_->audio_description().esds.aac,
508 &frame_buf, &subsamples)) {
509 MEDIA_LOG(ERROR, media_log_) << "Failed to prepare AAC sample for decode";
510 *err = true;
511 return false;
515 if (decrypt_config) {
516 if (!subsamples.empty()) {
517 // Create a new config with the updated subsamples.
518 decrypt_config.reset(new DecryptConfig(
519 decrypt_config->key_id(),
520 decrypt_config->iv(),
521 subsamples));
523 // else, use the existing config.
524 } else if ((audio && is_audio_track_encrypted_) ||
525 (video && is_video_track_encrypted_)) {
526 // The media pipeline requires a DecryptConfig with an empty |iv|.
527 // TODO(ddorwin): Refactor so we do not need a fake key ID ("1");
528 decrypt_config.reset(
529 new DecryptConfig("1", "", std::vector<SubsampleEntry>()));
532 StreamParserBuffer::Type buffer_type = audio ? DemuxerStream::AUDIO :
533 DemuxerStream::VIDEO;
535 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId
536 // type and allow multiple tracks for same media type, if applicable. See
537 // https://crbug.com/341581.
539 // NOTE: MPEG's "random access point" concept is equivalent to the
540 // downstream code's "is keyframe" concept.
541 scoped_refptr<StreamParserBuffer> stream_buf =
542 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(),
543 runs_->is_random_access_point(),
544 buffer_type, 0);
546 if (decrypt_config)
547 stream_buf->set_decrypt_config(decrypt_config.Pass());
549 stream_buf->set_duration(runs_->duration());
550 stream_buf->set_timestamp(runs_->cts());
551 stream_buf->SetDecodeTimestamp(runs_->dts());
553 DVLOG(3) << "Pushing frame: aud=" << audio
554 << ", key=" << runs_->is_keyframe()
555 << ", rap=" << runs_->is_random_access_point()
556 << ", dur=" << runs_->duration().InMilliseconds()
557 << ", dts=" << runs_->dts().InMilliseconds()
558 << ", cts=" << runs_->cts().InMilliseconds()
559 << ", size=" << runs_->sample_size();
561 if (audio) {
562 audio_buffers->push_back(stream_buf);
563 } else {
564 video_buffers->push_back(stream_buf);
567 runs_->AdvanceSample();
568 return true;
571 bool MP4StreamParser::SendAndFlushSamples(BufferQueue* audio_buffers,
572 BufferQueue* video_buffers) {
573 if (audio_buffers->empty() && video_buffers->empty())
574 return true;
576 TextBufferQueueMap empty_text_map;
577 bool success = new_buffers_cb_.Run(*audio_buffers,
578 *video_buffers,
579 empty_text_map);
580 audio_buffers->clear();
581 video_buffers->clear();
582 return success;
585 bool MP4StreamParser::ReadAndDiscardMDATsUntil(int64 max_clear_offset) {
586 bool err = false;
587 int64 upper_bound = std::min(max_clear_offset, queue_.tail());
588 while (mdat_tail_ < upper_bound) {
589 const uint8* buf = NULL;
590 int size = 0;
591 queue_.PeekAt(mdat_tail_, &buf, &size);
593 FourCC type;
594 int box_sz;
595 if (!BoxReader::StartTopLevelBox(buf, size, media_log_, &type, &box_sz,
596 &err))
597 break;
599 if (type != FOURCC_MDAT) {
600 MEDIA_LOG(DEBUG, media_log_)
601 << "Unexpected box type while parsing MDATs: "
602 << FourCCToString(type);
604 mdat_tail_ += box_sz;
606 queue_.Trim(std::min(mdat_tail_, upper_bound));
607 return !err;
610 void MP4StreamParser::ChangeState(State new_state) {
611 DVLOG(2) << "Changing state: " << new_state;
612 state_ = new_state;
615 bool MP4StreamParser::HaveEnoughDataToEnqueueSamples() {
616 DCHECK_EQ(state_, kWaitingForSampleData);
617 // For muxed content, make sure we have data up to |highest_end_offset_|
618 // so we can ensure proper enqueuing behavior. Otherwise assume we have enough
619 // data and allow per sample offset checks to meter sample enqueuing.
620 // TODO(acolwell): Fix trun box handling so we don't have to special case
621 // muxed content.
622 return !(has_audio_ && has_video_ &&
623 queue_.tail() < highest_end_offset_ + moof_head_);
626 bool MP4StreamParser::ComputeHighestEndOffset(const MovieFragment& moof) {
627 highest_end_offset_ = 0;
629 TrackRunIterator runs(moov_.get(), media_log_);
630 RCHECK(runs.Init(moof));
632 while (runs.IsRunValid()) {
633 int64 aux_info_end_offset = runs.aux_info_offset() + runs.aux_info_size();
634 if (aux_info_end_offset > highest_end_offset_)
635 highest_end_offset_ = aux_info_end_offset;
637 while (runs.IsSampleValid()) {
638 int64 sample_end_offset = runs.sample_offset() + runs.sample_size();
639 if (sample_end_offset > highest_end_offset_)
640 highest_end_offset_ = sample_end_offset;
642 runs.AdvanceSample();
644 runs.AdvanceRun();
647 return true;
650 } // namespace mp4
651 } // namespace media