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

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

Issue 10938034: Eliminate box reordering in media::mp4::BoxReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/mp4/box_reader.h ('k') | media/mp4/box_reader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/mp4/box_reader.h" 5 #include "media/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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 << std::hex << type; 156 << std::hex << type;
157 return false; 157 return false;
158 } 158 }
159 } 159 }
160 160
161 bool BoxReader::ScanChildren() { 161 bool BoxReader::ScanChildren() {
162 DCHECK(!scanned_); 162 DCHECK(!scanned_);
163 scanned_ = true; 163 scanned_ = true;
164 164
165 bool err = false; 165 bool err = false;
166 // TODO(strobe): Check or correct for multimap not inserting elements in
167 // consistent order.
168 while (pos() < size()) { 166 while (pos() < size()) {
169 BoxReader child(&buf_[pos_], size_ - pos_); 167 BoxReader child(&buf_[pos_], size_ - pos_);
170 if (!child.ReadHeader(&err)) break; 168 if (!child.ReadHeader(&err)) break;
171 169
172 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); 170 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child));
173 pos_ += child.size(); 171 pos_ += child.size();
174 } 172 }
175 173
176 DCHECK(!err); 174 DCHECK(!err);
177 return !err && pos() == size(); 175 return !err && pos() == size();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 225 }
228 226
229 // Note that the pos_ head has advanced to the byte immediately after the 227 // Note that the pos_ head has advanced to the byte immediately after the
230 // header, which is where we want it. 228 // header, which is where we want it.
231 size_ = size; 229 size_ = size;
232 return true; 230 return true;
233 } 231 }
234 232
235 } // namespace mp4 233 } // namespace mp4
236 } // namespace media 234 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/box_reader.h ('k') | media/mp4/box_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698