OLD | NEW |
---|---|
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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 } | 215 } |
216 | 216 |
217 bool BoxReader::ReadHeader(bool* err) { | 217 bool BoxReader::ReadHeader(bool* err) { |
218 uint64 size = 0; | 218 uint64 size = 0; |
219 *err = false; | 219 *err = false; |
220 | 220 |
221 if (!HasBytes(8)) return false; | 221 if (!HasBytes(8)) return false; |
222 CHECK(Read4Into8(&size) && ReadFourCC(&type_)); | 222 CHECK(Read4Into8(&size) && ReadFourCC(&type_)); |
223 | 223 |
224 if (size == 0) { | 224 if (size == 0) { |
225 // Media Source specific: we do not support boxes that run to EOS. | 225 MEDIA_LOG(DEBUG, log_cb_) << "Media Source Extensions do not support ISO " |
226 "BMFF boxes that run to EOS"; | |
chcunningham
2015/05/15 17:19:33
I don't know what this means. Why is size 0?
wolenetz
2015/05/15 18:16:25
:) I was simply log-ifying the previous comment in
| |
226 *err = true; | 227 *err = true; |
227 return false; | 228 return false; |
228 } else if (size == 1) { | 229 } else if (size == 1) { |
229 if (!HasBytes(8)) return false; | 230 if (!HasBytes(8)) return false; |
230 CHECK(Read8(&size)); | 231 CHECK(Read8(&size)); |
231 } | 232 } |
232 | 233 |
233 // Implementation-specific: support for boxes larger than 2^31 has been | 234 // Implementation-specific: support for boxes larger than 2^31 has been |
234 // removed. | 235 // removed. |
235 if (size < static_cast<uint64>(pos_) || | 236 if (size < static_cast<uint64>(pos_) || |
236 size > static_cast<uint64>(kint32max)) { | 237 size > static_cast<uint64>(kint32max)) { |
237 *err = true; | 238 *err = true; |
238 return false; | 239 return false; |
239 } | 240 } |
240 | 241 |
241 // Note that the pos_ head has advanced to the byte immediately after the | 242 // Note that the pos_ head has advanced to the byte immediately after the |
242 // header, which is where we want it. | 243 // header, which is where we want it. |
243 size_ = size; | 244 size_ = size; |
244 return true; | 245 return true; |
245 } | 246 } |
246 | 247 |
247 } // namespace mp4 | 248 } // namespace mp4 |
248 } // namespace media | 249 } // namespace media |
OLD | NEW |