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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Actually fix fuzzers. Created 3 years, 8 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
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/track_run_iterator.h" 5 #include "media/formats/mp4/track_run_iterator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iomanip> 8 #include <iomanip>
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DCHECK((timeb_in_us > 0) || 87 DCHECK((timeb_in_us > 0) ||
88 (timea_in_us >= std::numeric_limits<int64_t>::min() - timeb_in_us)); 88 (timea_in_us >= std::numeric_limits<int64_t>::min() - timeb_in_us));
89 return base::TimeDelta::FromMicroseconds(timea_in_us + timeb_in_us); 89 return base::TimeDelta::FromMicroseconds(timea_in_us + timeb_in_us);
90 } 90 }
91 91
92 DecodeTimestamp DecodeTimestampFromRational(int64_t numer, int64_t denom) { 92 DecodeTimestamp DecodeTimestampFromRational(int64_t numer, int64_t denom) {
93 return DecodeTimestamp::FromPresentationTime( 93 return DecodeTimestamp::FromPresentationTime(
94 TimeDeltaFromRational(numer, denom)); 94 TimeDeltaFromRational(numer, denom));
95 } 95 }
96 96
97 TrackRunIterator::TrackRunIterator(const Movie* moov, 97 TrackRunIterator::TrackRunIterator(const Movie* moov, MediaLog* media_log)
98 const scoped_refptr<MediaLog>& media_log)
99 : moov_(moov), media_log_(media_log), sample_offset_(0) { 98 : moov_(moov), media_log_(media_log), sample_offset_(0) {
100 CHECK(moov); 99 CHECK(moov);
101 } 100 }
102 101
103 TrackRunIterator::~TrackRunIterator() {} 102 TrackRunIterator::~TrackRunIterator() {}
104 103
105 static std::string HexFlags(uint32_t flags) { 104 static std::string HexFlags(uint32_t flags) {
106 std::stringstream stream; 105 std::stringstream stream;
107 stream << std::setfill('0') << std::setw(sizeof(flags)*2) << std::hex 106 stream << std::setfill('0') << std::setw(sizeof(flags)*2) << std::hex
108 << flags; 107 << flags;
109 return stream.str(); 108 return stream.str();
110 } 109 }
111 110
112 static bool PopulateSampleInfo(const TrackExtends& trex, 111 static bool PopulateSampleInfo(const TrackExtends& trex,
113 const TrackFragmentHeader& tfhd, 112 const TrackFragmentHeader& tfhd,
114 const TrackFragmentRun& trun, 113 const TrackFragmentRun& trun,
115 const int64_t edit_list_offset, 114 const int64_t edit_list_offset,
116 const uint32_t i, 115 const uint32_t i,
117 SampleInfo* sample_info, 116 SampleInfo* sample_info,
118 const SampleDependsOn sdtp_sample_depends_on, 117 const SampleDependsOn sdtp_sample_depends_on,
119 bool is_audio, 118 bool is_audio,
120 const scoped_refptr<MediaLog>& media_log) { 119 MediaLog* media_log) {
121 if (i < trun.sample_sizes.size()) { 120 if (i < trun.sample_sizes.size()) {
122 sample_info->size = trun.sample_sizes[i]; 121 sample_info->size = trun.sample_sizes[i];
123 } else if (tfhd.default_sample_size > 0) { 122 } else if (tfhd.default_sample_size > 0) {
124 sample_info->size = tfhd.default_sample_size; 123 sample_info->size = tfhd.default_sample_size;
125 } else { 124 } else {
126 sample_info->size = trex.default_sample_size; 125 sample_info->size = trex.default_sample_size;
127 } 126 }
128 127
129 if (i < trun.sample_durations.size()) { 128 if (i < trun.sample_durations.size()) {
130 sample_info->duration = trun.sample_durations[i]; 129 sample_info->duration = trun.sample_durations[i];
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 index == 0 ? track_encryption().default_constant_iv 711 index == 0 ? track_encryption().default_constant_iv
713 : GetSampleEncryptionInfoEntry(*run_itr_, index)->constant_iv; 712 : GetSampleEncryptionInfoEntry(*run_itr_, index)->constant_iv;
714 RCHECK(constant_iv != nullptr); 713 RCHECK(constant_iv != nullptr);
715 memcpy(entry->initialization_vector, constant_iv, kInitializationVectorSize); 714 memcpy(entry->initialization_vector, constant_iv, kInitializationVectorSize);
716 return true; 715 return true;
717 } 716 }
718 #endif 717 #endif
719 718
720 } // namespace mp4 719 } // namespace mp4
721 } // namespace media 720 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698