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

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

Issue 1147453002: MSE: Increase log visibility when unfragmented MP4 causes parse failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and addressed chcunningham's PS1 comments Created 5 years, 7 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/box_reader.h" 5 #include "media/formats/mp4/box_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <set> 9 #include <set>
10 10
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 bool BoxReader::ReadHeader(bool* err) { 214 bool BoxReader::ReadHeader(bool* err) {
215 uint64 size = 0; 215 uint64 size = 0;
216 *err = false; 216 *err = false;
217 217
218 if (!HasBytes(8)) return false; 218 if (!HasBytes(8)) return false;
219 CHECK(Read4Into8(&size) && ReadFourCC(&type_)); 219 CHECK(Read4Into8(&size) && ReadFourCC(&type_));
220 220
221 if (size == 0) { 221 if (size == 0) {
222 // Media Source specific: we do not support boxes that run to EOS. 222 MEDIA_LOG(DEBUG, log_cb_) << "Media Source Extensions do not support ISO "
223 "BMFF boxes that run to EOS";
223 *err = true; 224 *err = true;
224 return false; 225 return false;
225 } else if (size == 1) { 226 } else if (size == 1) {
226 if (!HasBytes(8)) return false; 227 if (!HasBytes(8)) return false;
227 CHECK(Read8(&size)); 228 CHECK(Read8(&size));
228 } 229 }
229 230
230 // Implementation-specific: support for boxes larger than 2^31 has been 231 // Implementation-specific: support for boxes larger than 2^31 has been
231 // removed. 232 // removed.
232 if (size < static_cast<uint64>(pos_) || 233 if (size < static_cast<uint64>(pos_) ||
233 size > static_cast<uint64>(kint32max)) { 234 size > static_cast<uint64>(kint32max)) {
234 *err = true; 235 *err = true;
235 return false; 236 return false;
236 } 237 }
237 238
238 // Note that the pos_ head has advanced to the byte immediately after the 239 // Note that the pos_ head has advanced to the byte immediately after the
239 // header, which is where we want it. 240 // header, which is where we want it.
240 size_ = size; 241 size_ = size;
241 return true; 242 return true;
242 } 243 }
243 244
244 } // namespace mp4 245 } // namespace mp4
245 } // namespace media 246 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698