Chromium Code Reviews| Index: media/formats/mp4/avc.cc |
| diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc |
| index 2067e51539f697a3b02ffa95e4c3ea97a2129a5f..8e49c131aaee870241154b346eb6158fc5d8f6ad 100644 |
| --- a/media/formats/mp4/avc.cc |
| +++ b/media/formats/mp4/avc.cc |
| @@ -107,8 +107,10 @@ bool AVC::ConvertFrameToAnnexB(int length_size, |
| // static |
| bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config, |
| std::vector<uint8_t>* buffer, |
| - std::vector<SubsampleEntry>* subsamples) { |
| - DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples)); |
| + std::vector<SubsampleEntry>* subsamples, |
| + bool annexb_validation) { |
| + if (annexb_validation) |
|
wolenetz
2017/01/25 23:42:41
It looks like this production parameter is used on
|
| + DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples)); |
| std::unique_ptr<H264Parser> parser(new H264Parser()); |
| const uint8_t* start = &(*buffer)[0]; |
| @@ -143,7 +145,8 @@ bool AVC::InsertParamSetsAnnexB(const AVCDecoderConfigurationRecord& avc_config, |
| buffer->insert(config_insert_point, |
| param_sets.begin(), param_sets.end()); |
| - DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples)); |
| + if (annexb_validation) |
|
wolenetz
2017/01/25 23:42:41
ditto.
|
| + DCHECK(AVC::IsValidAnnexB(*buffer, *subsamples)); |
| return true; |
| } |
| @@ -318,6 +321,7 @@ AVCBitstreamConverter::AVCBitstreamConverter( |
| std::unique_ptr<AVCDecoderConfigurationRecord> avc_config) |
| : avc_config_(std::move(avc_config)) { |
| DCHECK(avc_config_); |
| + post_annexb_validation_ = true; |
|
wolenetz
2017/01/25 23:42:41
generally, we set these in the initializers (or in
erickung1
2017/02/03 18:18:31
Done.
|
| } |
| AVCBitstreamConverter::~AVCBitstreamConverter() { |
| @@ -339,7 +343,8 @@ bool AVCBitstreamConverter::ConvertFrame( |
| // If this is a keyframe, we (re-)inject SPS and PPS headers at the start of |
| // a frame. If subsample info is present, we also update the clear byte |
| // count for that first subsample. |
| - RCHECK(AVC::InsertParamSetsAnnexB(*avc_config_, frame_buf, subsamples)); |
| + RCHECK(AVC::InsertParamSetsAnnexB(*avc_config_, frame_buf, subsamples, |
| + post_annexb_validation_)); |
| } |
| DCHECK(AVC::IsValidAnnexB(*frame_buf, *subsamples)); |