Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 2365653006: Address review nits from r420647 (Closed)
Patch Set: Fix typo in header Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/mp4/mp4_stream_parser.h" 5 #include "media/formats/mp4/mp4_stream_parser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 17 matching lines...) Expand all
28 #include "media/formats/mp4/box_reader.h" 28 #include "media/formats/mp4/box_reader.h"
29 #include "media/formats/mp4/es_descriptor.h" 29 #include "media/formats/mp4/es_descriptor.h"
30 #include "media/formats/mp4/rcheck.h" 30 #include "media/formats/mp4/rcheck.h"
31 #include "media/formats/mpeg/adts_constants.h" 31 #include "media/formats/mpeg/adts_constants.h"
32 32
33 namespace media { 33 namespace media {
34 namespace mp4 { 34 namespace mp4 {
35 35
36 namespace { 36 namespace {
37 const int kMaxEmptySampleLogs = 20; 37 const int kMaxEmptySampleLogs = 20;
38 } 38 } // namespace
39 39
40 MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types, 40 MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types,
41 bool has_sbr) 41 bool has_sbr)
42 : state_(kWaitingForInit), 42 : state_(kWaitingForInit),
43 moof_head_(0), 43 moof_head_(0),
44 mdat_tail_(0), 44 mdat_tail_(0),
45 highest_end_offset_(0), 45 highest_end_offset_(0),
46 has_audio_(false), 46 has_audio_(false),
47 has_video_(false), 47 has_video_(false),
48 audio_object_types_(audio_object_types), 48 audio_object_types_(audio_object_types),
49 has_sbr_(has_sbr), 49 has_sbr_(has_sbr),
50 num_top_level_box_skipped_(0), 50 num_empty_samples_skipped_(0) {}
51 num_emtpy_samples_skipped_(0) {}
52 51
53 MP4StreamParser::~MP4StreamParser() {} 52 MP4StreamParser::~MP4StreamParser() {}
54 53
55 void MP4StreamParser::Init( 54 void MP4StreamParser::Init(
56 const InitCB& init_cb, 55 const InitCB& init_cb,
57 const NewConfigCB& config_cb, 56 const NewConfigCB& config_cb,
58 const NewBuffersCB& new_buffers_cb, 57 const NewBuffersCB& new_buffers_cb,
59 bool /* ignore_text_tracks */, 58 bool /* ignore_text_tracks */,
60 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 59 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
61 const NewMediaSegmentCB& new_segment_cb, 60 const NewMediaSegmentCB& new_segment_cb,
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 *err = !runs_->CacheAuxInfo(buf, buf_size); 556 *err = !runs_->CacheAuxInfo(buf, buf_size);
558 return !*err; 557 return !*err;
559 } 558 }
560 559
561 queue_.PeekAt(runs_->sample_offset() + moof_head_, &buf, &buf_size); 560 queue_.PeekAt(runs_->sample_offset() + moof_head_, &buf, &buf_size);
562 if (buf_size < runs_->sample_size()) return false; 561 if (buf_size < runs_->sample_size()) return false;
563 562
564 if (runs_->sample_size() == 0) { 563 if (runs_->sample_size() == 0) {
565 // Generally not expected, but spec allows it. Code below this block assumes 564 // Generally not expected, but spec allows it. Code below this block assumes
566 // the current sample is not empty. 565 // the current sample is not empty.
567 LIMITED_MEDIA_LOG(DEBUG, media_log_, num_emtpy_samples_skipped_, 566 LIMITED_MEDIA_LOG(DEBUG, media_log_, num_empty_samples_skipped_,
568 kMaxEmptySampleLogs) 567 kMaxEmptySampleLogs)
569 << " Skipping 'trun' sample with size of 0."; 568 << " Skipping 'trun' sample with size of 0.";
570 runs_->AdvanceSample(); 569 runs_->AdvanceSample();
571 return true; 570 return true;
572 } 571 }
573 572
574 std::unique_ptr<DecryptConfig> decrypt_config; 573 std::unique_ptr<DecryptConfig> decrypt_config;
575 std::vector<SubsampleEntry> subsamples; 574 std::vector<SubsampleEntry> subsamples;
576 if (runs_->is_encrypted()) { 575 if (runs_->is_encrypted()) {
577 decrypt_config = runs_->GetDecryptConfig(); 576 decrypt_config = runs_->GetDecryptConfig();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 runs.AdvanceSample(); 717 runs.AdvanceSample();
719 } 718 }
720 runs.AdvanceRun(); 719 runs.AdvanceRun();
721 } 720 }
722 721
723 return true; 722 return true;
724 } 723 }
725 724
726 } // namespace mp4 725 } // namespace mp4
727 } // namespace media 726 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698