| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/hevc.h" | 5 #include "media/formats/mp4/hevc.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "media/base/decrypt_config.h" | 12 #include "media/base/decrypt_config.h" |
| 12 #include "media/filters/h265_parser.h" | 13 #include "media/filters/h265_parser.h" |
| 13 #include "media/formats/mp4/avc.h" | 14 #include "media/formats/mp4/avc.h" |
| 14 #include "media/formats/mp4/box_definitions.h" | 15 #include "media/formats/mp4/box_definitions.h" |
| 15 #include "media/formats/mp4/box_reader.h" | 16 #include "media/formats/mp4/box_reader.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 203 |
| 203 if (size == 0) | 204 if (size == 0) |
| 204 return true; | 205 return true; |
| 205 | 206 |
| 206 // TODO(servolk): Implement this, see crbug.com/527595 | 207 // TODO(servolk): Implement this, see crbug.com/527595 |
| 207 return true; | 208 return true; |
| 208 } | 209 } |
| 209 | 210 |
| 210 HEVCBitstreamConverter::HEVCBitstreamConverter( | 211 HEVCBitstreamConverter::HEVCBitstreamConverter( |
| 211 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config) | 212 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config) |
| 212 : hevc_config_(hevc_config.Pass()) { | 213 : hevc_config_(std::move(hevc_config)) { |
| 213 DCHECK(hevc_config_); | 214 DCHECK(hevc_config_); |
| 214 } | 215 } |
| 215 | 216 |
| 216 HEVCBitstreamConverter::~HEVCBitstreamConverter() { | 217 HEVCBitstreamConverter::~HEVCBitstreamConverter() { |
| 217 } | 218 } |
| 218 | 219 |
| 219 bool HEVCBitstreamConverter::ConvertFrame( | 220 bool HEVCBitstreamConverter::ConvertFrame( |
| 220 std::vector<uint8_t>* frame_buf, | 221 std::vector<uint8_t>* frame_buf, |
| 221 bool is_keyframe, | 222 bool is_keyframe, |
| 222 std::vector<SubsampleEntry>* subsamples) const { | 223 std::vector<SubsampleEntry>* subsamples) const { |
| 223 RCHECK(AVC::ConvertFrameToAnnexB(hevc_config_->lengthSizeMinusOne + 1, | 224 RCHECK(AVC::ConvertFrameToAnnexB(hevc_config_->lengthSizeMinusOne + 1, |
| 224 frame_buf, subsamples)); | 225 frame_buf, subsamples)); |
| 225 | 226 |
| 226 if (is_keyframe) { | 227 if (is_keyframe) { |
| 227 // If this is a keyframe, we (re-)inject HEVC params headers at the start of | 228 // If this is a keyframe, we (re-)inject HEVC params headers at the start of |
| 228 // a frame. If subsample info is present, we also update the clear byte | 229 // a frame. If subsample info is present, we also update the clear byte |
| 229 // count for that first subsample. | 230 // count for that first subsample. |
| 230 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); | 231 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); |
| 231 } | 232 } |
| 232 | 233 |
| 233 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); | 234 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); |
| 234 return true; | 235 return true; |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace mp4 | 238 } // namespace mp4 |
| 238 } // namespace media | 239 } // namespace media |
| OLD | NEW |