Commit c73bc60c authored by servolk's avatar servolk Committed by Commit bot

Use the correct HEVC profile in VideoDecoderConfig

Review-Url: https://codereview.chromium.org/2317273003
Cr-Commit-Position: refs/heads/master@{#417360}
parent 794e7d9b
......@@ -681,9 +681,10 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
new HEVCDecoderConfigurationRecord());
RCHECK(reader->ReadChild(hevcConfig.get()));
video_codec = kCodecHEVC;
video_codec_profile = hevcConfig->GetVideoProfile();
frame_bitstream_converter =
make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
video_codec = kCodecHEVC;
break;
}
#endif
......
......@@ -124,6 +124,20 @@ bool HEVCDecoderConfigurationRecord::ParseInternal(
return true;
}
VideoCodecProfile HEVCDecoderConfigurationRecord::GetVideoProfile() const {
// The values of general_profile_idc are taken from the HEVC standard, see
// the latest https://www.itu.int/rec/T-REC-H.265/en section A.3
switch (general_profile_idc) {
case 1:
return HEVCPROFILE_MAIN;
case 2:
return HEVCPROFILE_MAIN10;
case 3:
return HEVCPROFILE_MAIN_STILL_PICTURE;
}
return VIDEO_CODEC_PROFILE_UNKNOWN;
}
static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1};
static const int kAnnexBStartCodeSize = 4;
......
......@@ -12,6 +12,7 @@
#include <vector>
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
#include "media/formats/mp4/bitstream_converter.h"
#include "media/formats/mp4/box_definitions.h"
......@@ -60,6 +61,8 @@ struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box {
};
std::vector<HVCCNALArray> arrays;
VideoCodecProfile GetVideoProfile() const;
private:
bool ParseInternal(BufferReader* reader,
const scoped_refptr<MediaLog>& media_log);
......
......@@ -371,6 +371,10 @@ TEST_F(MP4StreamParserTest, HEVC_in_MP4_container) {
scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("bear-hevc-frag.mp4");
EXPECT_EQ(expect_success,
AppendDataInPieces(buffer->data(), buffer->data_size(), 512));
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
EXPECT_EQ(kCodecHEVC, video_decoder_config_.codec());
EXPECT_EQ(HEVCPROFILE_MAIN, video_decoder_config_.profile());
#endif
}
// Sample encryption information is stored as CencSampleAuxiliaryDataFormat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment