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

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

Issue 2254733006: Allow MP4 parser to handle multiple audio and video tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merged-buffers-map
Patch Set: CR feedback Created 4 years, 4 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 | « no previous file | media/formats/mp4/mp4_stream_parser.h » ('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 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/avc.h" 5 #include "media/formats/mp4/avc.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 NOTREACHED(); 59 NOTREACHED();
60 return 0; 60 return 0;
61 } 61 }
62 62
63 // static 63 // static
64 bool AVC::ConvertFrameToAnnexB(int length_size, 64 bool AVC::ConvertFrameToAnnexB(int length_size,
65 std::vector<uint8_t>* buffer, 65 std::vector<uint8_t>* buffer,
66 std::vector<SubsampleEntry>* subsamples) { 66 std::vector<SubsampleEntry>* subsamples) {
67 RCHECK(length_size == 1 || length_size == 2 || length_size == 4); 67 RCHECK(length_size == 1 || length_size == 2 || length_size == 4);
68 DVLOG(5) << __FUNCTION__ << " length_size=" << length_size
69 << " buffer->size()=" << buffer->size()
70 << " subsamples=" << (subsamples ? subsamples->size() : 0);
68 71
69 if (length_size == 4) 72 if (length_size == 4)
70 return ConvertAVCToAnnexBInPlaceForLengthSize4(buffer); 73 return ConvertAVCToAnnexBInPlaceForLengthSize4(buffer);
71 74
72 std::vector<uint8_t> temp; 75 std::vector<uint8_t> temp;
73 temp.swap(*buffer); 76 temp.swap(*buffer);
74 buffer->reserve(temp.size() + 32); 77 buffer->reserve(temp.size() + 32);
75 78
76 size_t pos = 0; 79 size_t pos = 0;
77 while (pos + length_size < temp.size()) { 80 while (pos + length_size < temp.size()) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // count for that first subsample. 341 // count for that first subsample.
339 RCHECK(AVC::InsertParamSetsAnnexB(*avc_config_, frame_buf, subsamples)); 342 RCHECK(AVC::InsertParamSetsAnnexB(*avc_config_, frame_buf, subsamples));
340 } 343 }
341 344
342 DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples)); 345 DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples));
343 return true; 346 return true;
344 } 347 }
345 348
346 } // namespace mp4 349 } // namespace mp4
347 } // namespace media 350 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/formats/mp4/mp4_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698