| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |