Rename StreamInfo::extra_data to codec_config.

Since the |extra_data| field contains codec-specific configuration
data, it makes sense to call it |codec_config|.

Change-Id: If9e35165a00fe82628cf931df397a8ef06505b0d
This commit is contained in:
Jacob Trimble 2016-06-27 12:30:32 -07:00
parent ebd76aba27
commit abb1abf5c5
24 changed files with 90 additions and 90 deletions

View File

@ -61,8 +61,8 @@ AudioStreamInfo::AudioStreamInfo(int track_id,
uint64_t codec_delay_ns, uint64_t codec_delay_ns,
uint32_t max_bitrate, uint32_t max_bitrate,
uint32_t avg_bitrate, uint32_t avg_bitrate,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted) bool is_encrypted)
: StreamInfo(kStreamAudio, : StreamInfo(kStreamAudio,
track_id, track_id,
@ -70,8 +70,8 @@ AudioStreamInfo::AudioStreamInfo(int track_id,
duration, duration,
codec_string, codec_string,
language, language,
extra_data, codec_config,
extra_data_size, codec_config_size,
is_encrypted), is_encrypted),
codec_(codec), codec_(codec),
sample_bits_(sample_bits), sample_bits_(sample_bits),

View File

@ -48,8 +48,8 @@ class AudioStreamInfo : public StreamInfo {
uint64_t codec_delay_ns, uint64_t codec_delay_ns,
uint32_t max_bitrate, uint32_t max_bitrate,
uint32_t avg_bitrate, uint32_t avg_bitrate,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted); bool is_encrypted);
/// @name StreamInfo implementation overrides. /// @name StreamInfo implementation overrides.

View File

@ -20,8 +20,8 @@ StreamInfo::StreamInfo(StreamType stream_type,
uint64_t duration, uint64_t duration,
const std::string& codec_string, const std::string& codec_string,
const std::string& language, const std::string& language,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted) bool is_encrypted)
: stream_type_(stream_type), : stream_type_(stream_type),
track_id_(track_id), track_id_(track_id),
@ -30,8 +30,8 @@ StreamInfo::StreamInfo(StreamType stream_type,
codec_string_(codec_string), codec_string_(codec_string),
language_(language), language_(language),
is_encrypted_(is_encrypted) { is_encrypted_(is_encrypted) {
if (extra_data_size > 0) { if (codec_config_size > 0) {
extra_data_.assign(extra_data, extra_data + extra_data_size); codec_config_.assign(codec_config, codec_config + codec_config_size);
} }
} }

View File

@ -31,8 +31,8 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
uint64_t duration, uint64_t duration,
const std::string& codec_string, const std::string& codec_string,
const std::string& language, const std::string& language,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted); bool is_encrypted);
/// @return true if this object has appropriate configuration values, false /// @return true if this object has appropriate configuration values, false
@ -51,11 +51,11 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
bool is_encrypted() const { return is_encrypted_; } bool is_encrypted() const { return is_encrypted_; }
const std::vector<uint8_t>& extra_data() const { return extra_data_; } const std::vector<uint8_t>& codec_config() const { return codec_config_; }
void set_duration(int duration) { duration_ = duration; } void set_duration(int duration) { duration_ = duration; }
void set_extra_data(const std::vector<uint8_t>& data) { extra_data_ = data; } void set_codec_config(const std::vector<uint8_t>& data) { codec_config_ = data; }
void set_codec_string(const std::string& codec_string) { void set_codec_string(const std::string& codec_string) {
codec_string_ = codec_string; codec_string_ = codec_string;
@ -83,7 +83,7 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
bool is_encrypted_; bool is_encrypted_;
// Optional byte data required for some audio/video decoders such as Vorbis // Optional byte data required for some audio/video decoders such as Vorbis
// codebooks. // codebooks.
std::vector<uint8_t> extra_data_; std::vector<uint8_t> codec_config_;
// Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler
// generated copy constructor and assignment operator. Since the extra data is // generated copy constructor and assignment operator. Since the extra data is

View File

@ -14,7 +14,7 @@ TextStreamInfo::TextStreamInfo(int track_id,
uint64_t duration, uint64_t duration,
const std::string& codec_string, const std::string& codec_string,
const std::string& language, const std::string& language,
const std::string& extra_data, const std::string& codec_config,
uint16_t width, uint16_t width,
uint16_t height) uint16_t height)
: StreamInfo(kStreamText, : StreamInfo(kStreamText,
@ -23,8 +23,8 @@ TextStreamInfo::TextStreamInfo(int track_id,
duration, duration,
codec_string, codec_string,
language, language,
reinterpret_cast<const uint8_t*>(extra_data.data()), reinterpret_cast<const uint8_t*>(codec_config.data()),
extra_data.size(), codec_config.size(),
false), false),
width_(width), width_(width),
height_(height) {} height_(height) {}

View File

@ -22,9 +22,9 @@ class TextStreamInfo : public StreamInfo {
/// @param duration is the duration of this stream. /// @param duration is the duration of this stream.
/// @param codec_string is the codec. /// @param codec_string is the codec.
/// @param language is the language of this stream. This may be empty. /// @param language is the language of this stream. This may be empty.
/// @param extra_data is extra data for this text stream. This could be the /// @param codec_config is configuration for this text stream. This could be
/// metadata that applies to all the samples of this stream. This may /// the metadata that applies to all the samples of this stream. This
/// be empty. /// may be empty.
/// @param width of the text. This may be 0. /// @param width of the text. This may be 0.
/// @param height of the text. This may be 0. /// @param height of the text. This may be 0.
TextStreamInfo(int track_id, TextStreamInfo(int track_id,
@ -32,7 +32,7 @@ class TextStreamInfo : public StreamInfo {
uint64_t duration, uint64_t duration,
const std::string& codec_string, const std::string& codec_string,
const std::string& language, const std::string& language,
const std::string& extra_data, const std::string& codec_config,
uint16_t width, uint16_t width,
uint16_t height); uint16_t height);

View File

@ -59,8 +59,8 @@ VideoStreamInfo::VideoStreamInfo(int track_id,
uint32_t pixel_height, uint32_t pixel_height,
int16_t trick_play_rate, int16_t trick_play_rate,
uint8_t nalu_length_size, uint8_t nalu_length_size,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted) bool is_encrypted)
: StreamInfo(kStreamVideo, : StreamInfo(kStreamVideo,
track_id, track_id,
@ -68,8 +68,8 @@ VideoStreamInfo::VideoStreamInfo(int track_id,
duration, duration,
codec_string, codec_string,
language, language,
extra_data, codec_config,
extra_data_size, codec_config_size,
is_encrypted), is_encrypted),
codec_(codec), codec_(codec),
width_(width), width_(width),

View File

@ -45,8 +45,8 @@ class VideoStreamInfo : public StreamInfo {
uint32_t pixel_height, uint32_t pixel_height,
int16_t trick_play_rate, int16_t trick_play_rate,
uint8_t nalu_length_size, uint8_t nalu_length_size,
const uint8_t* extra_data, const uint8_t* codec_config,
size_t extra_data_size, size_t codec_config_size,
bool is_encrypted); bool is_encrypted);
/// @name StreamInfo implementation overrides. /// @name StreamInfo implementation overrides.

View File

@ -96,9 +96,9 @@ void AddVideoInfo(const VideoStreamInfo* video_stream_info,
if (video_stream_info->pixel_height() > 0) if (video_stream_info->pixel_height() > 0)
video_info->set_pixel_height(video_stream_info->pixel_height()); video_info->set_pixel_height(video_stream_info->pixel_height());
const std::vector<uint8_t>& extra_data = video_stream_info->extra_data(); const std::vector<uint8_t>& codec_config = video_stream_info->codec_config();
if (!extra_data.empty()) { if (!codec_config.empty()) {
video_info->set_decoder_config(&extra_data[0], extra_data.size()); video_info->set_decoder_config(&codec_config[0], codec_config.size());
} }
} }
@ -118,14 +118,14 @@ void AddAudioInfo(const AudioStreamInfo* audio_stream_info,
audio_info->set_language(language); audio_info->set_language(language);
} }
const std::vector<uint8_t>& extra_data = audio_stream_info->extra_data(); const std::vector<uint8_t>& codec_config = audio_stream_info->codec_config();
if (!extra_data.empty()) { if (!codec_config.empty()) {
audio_info->set_decoder_config(&extra_data[0], extra_data.size()); audio_info->set_decoder_config(&codec_config[0], codec_config.size());
} }
if (audio_stream_info->codec_string() == "ec-3") { if (audio_stream_info->codec_string() == "ec-3") {
uint32_t ec3_channel_map; uint32_t ec3_channel_map;
if (!CalculateEC3ChannelMap(extra_data, &ec3_channel_map)) { if (!CalculateEC3ChannelMap(codec_config, &ec3_channel_map)) {
LOG(ERROR) << "Failed to calculate EC3 channel map."; LOG(ERROR) << "Failed to calculate EC3 channel map.";
return; return;
} }

View File

@ -29,8 +29,8 @@ scoped_refptr<StreamInfo> CreateVideoStreamInfo(
param.pixel_height, param.pixel_height,
0, // trick_play_rate 0, // trick_play_rate
param.nalu_length_size, param.nalu_length_size,
param.extra_data.data(), param.codec_config.data(),
param.extra_data.size(), param.codec_config.size(),
param.is_encrypted)); param.is_encrypted));
} }
@ -60,7 +60,7 @@ VideoStreamInfoParameters GetDefaultVideoStreamInfoParams() {
params.pixel_width = kPixelWidth; params.pixel_width = kPixelWidth;
params.pixel_height = kPixelHeight; params.pixel_height = kPixelHeight;
params.nalu_length_size = kNaluLengthSize; params.nalu_length_size = kNaluLengthSize;
params.extra_data = kExtraData; params.codec_config = kExtraData;
params.is_encrypted = kEncryptedFlag; params.is_encrypted = kEncryptedFlag;
return params; return params;
} }

View File

@ -68,7 +68,7 @@ struct VideoStreamInfoParameters {
uint32_t pixel_width; uint32_t pixel_width;
uint32_t pixel_height; uint32_t pixel_height;
uint8_t nalu_length_size; uint8_t nalu_length_size;
std::vector<uint8_t> extra_data; std::vector<uint8_t> codec_config;
bool is_encrypted; bool is_encrypted;
}; };

View File

@ -205,7 +205,7 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_frame,
if (last_audio_decoder_config_) { if (last_audio_decoder_config_) {
// Verify that the audio decoder config has not changed. // Verify that the audio decoder config has not changed.
if (last_audio_decoder_config_->extra_data() == audio_specific_config) { if (last_audio_decoder_config_->codec_config() == audio_specific_config) {
// Audio configuration has not changed. // Audio configuration has not changed.
return true; return true;
} }

View File

@ -121,14 +121,14 @@ bool EsParserH264::UpdateVideoDecoderConfig(int pps_id) {
} }
if (last_video_decoder_config_) { if (last_video_decoder_config_) {
if (last_video_decoder_config_->extra_data() != decoder_config_record) { if (last_video_decoder_config_->codec_config() != decoder_config_record) {
// Video configuration has changed. Issue warning. // Video configuration has changed. Issue warning.
// TODO(tinskip): Check the nature of the configuration change. Only // TODO(tinskip): Check the nature of the configuration change. Only
// minor configuration changes (such as frame ordering) can be handled // minor configuration changes (such as frame ordering) can be handled
// gracefully by decoders without notification. Major changes (such as // gracefully by decoders without notification. Major changes (such as
// video resolution changes) should be treated as errors. // video resolution changes) should be treated as errors.
LOG(WARNING) << "H.264 decoder configuration has changed."; LOG(WARNING) << "H.264 decoder configuration has changed.";
last_video_decoder_config_->set_extra_data(decoder_config_record); last_video_decoder_config_->set_codec_config(decoder_config_record);
} }
return true; return true;
} }

View File

@ -126,14 +126,14 @@ bool EsParserH265::UpdateVideoDecoderConfig(int pps_id) {
} }
if (last_video_decoder_config_) { if (last_video_decoder_config_) {
if (last_video_decoder_config_->extra_data() != decoder_config_record) { if (last_video_decoder_config_->codec_config() != decoder_config_record) {
// Video configuration has changed. Issue warning. // Video configuration has changed. Issue warning.
// TODO(tinskip): Check the nature of the configuration change. Only // TODO(tinskip): Check the nature of the configuration change. Only
// minor configuration changes (such as frame ordering) can be handled // minor configuration changes (such as frame ordering) can be handled
// gracefully by decoders without notification. Major changes (such as // gracefully by decoders without notification. Major changes (such as
// video resolution changes) should be treated as errors. // video resolution changes) should be treated as errors.
LOG(WARNING) << "H.265 decoder configuration has changed."; LOG(WARNING) << "H.265 decoder configuration has changed.";
last_video_decoder_config_->set_extra_data(decoder_config_record); last_video_decoder_config_->set_codec_config(decoder_config_record);
} }
return true; return true;
} }

View File

@ -104,8 +104,8 @@ bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) {
} }
timescale_scale_ = kTsTimescale / video_stream_info.time_scale(); timescale_scale_ = kTsTimescale / video_stream_info.time_scale();
converter_.reset(new NalUnitToByteStreamConverter()); converter_.reset(new NalUnitToByteStreamConverter());
return converter_->Initialize(video_stream_info.extra_data().data(), return converter_->Initialize(video_stream_info.codec_config().data(),
video_stream_info.extra_data().size(), video_stream_info.codec_config().size(),
!kEscapeData); !kEscapeData);
} else if (stream_type_ == kStreamAudio) { } else if (stream_type_ == kStreamAudio) {
const AudioStreamInfo& audio_stream_info = const AudioStreamInfo& audio_stream_info =
@ -117,7 +117,7 @@ bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) {
} }
timescale_scale_ = kTsTimescale / audio_stream_info.time_scale(); timescale_scale_ = kTsTimescale / audio_stream_info.time_scale();
adts_converter_.reset(new AACAudioSpecificConfig()); adts_converter_.reset(new AACAudioSpecificConfig());
return adts_converter_->Parse(audio_stream_info.extra_data()); return adts_converter_->Parse(audio_stream_info.codec_config());
} }
NOTIMPLEMENTED() << "Stream type: " << stream_type_ << " not implemented."; NOTIMPLEMENTED() << "Stream type: " << stream_type_ << " not implemented.";

View File

@ -191,7 +191,7 @@ bool TsWriter::Initialize(const StreamInfo& stream_info,
return false; return false;
} }
pmt_writer_.reset(new AacProgramMapTableWriter( pmt_writer_.reset(new AacProgramMapTableWriter(
audio_stream_info.extra_data(), &pmt_continuity_counter_)); audio_stream_info.codec_config(), &pmt_continuity_counter_));
} }
will_be_encrypted_ = will_be_encrypted; will_be_encrypted_ = will_be_encrypted;

View File

@ -122,7 +122,7 @@ Status EncryptingFragmenter::InitializeFragment(int64_t first_sample_dts) {
if (!status.ok()) if (!status.ok())
return status; return status;
if (header_parser_ && !header_parser_->Initialize(info_->extra_data())) if (header_parser_ && !header_parser_->Initialize(info_->codec_config()))
return Status(error::MUXER_FAILURE, "Fail to read SPS and PPS data."); return Status(error::MUXER_FAILURE, "Fail to read SPS and PPS data.");
traf()->auxiliary_size.sample_info_sizes.clear(); traf()->auxiliary_size.sample_info_sizes.clear();

View File

@ -350,7 +350,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
uint8_t audio_object_type = 0; uint8_t audio_object_type = 0;
uint32_t max_bitrate = 0; uint32_t max_bitrate = 0;
uint32_t avg_bitrate = 0; uint32_t avg_bitrate = 0;
std::vector<uint8_t> extra_data; std::vector<uint8_t> codec_config;
switch (actual_format) { switch (actual_format) {
case FOURCC_mp4a: case FOURCC_mp4a:
@ -363,7 +363,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
num_channels = aac_audio_specific_config.num_channels(); num_channels = aac_audio_specific_config.num_channels();
sampling_frequency = aac_audio_specific_config.frequency(); sampling_frequency = aac_audio_specific_config.frequency();
audio_object_type = aac_audio_specific_config.audio_object_type(); audio_object_type = aac_audio_specific_config.audio_object_type();
extra_data = entry.esds.es_descriptor.decoder_specific_info(); codec_config = entry.esds.es_descriptor.decoder_specific_info();
break; break;
} else if (entry.esds.es_descriptor.IsDTS()) { } else if (entry.esds.es_descriptor.IsDTS()) {
ObjectType audio_type = entry.esds.es_descriptor.object_type(); ObjectType audio_type = entry.esds.es_descriptor.object_type();
@ -411,24 +411,24 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
case FOURCC_dtse: case FOURCC_dtse:
FALLTHROUGH_INTENDED; FALLTHROUGH_INTENDED;
case FOURCC_dtsm: case FOURCC_dtsm:
extra_data = entry.ddts.extra_data; codec_config = entry.ddts.extra_data;
max_bitrate = entry.ddts.max_bitrate; max_bitrate = entry.ddts.max_bitrate;
avg_bitrate = entry.ddts.avg_bitrate; avg_bitrate = entry.ddts.avg_bitrate;
num_channels = entry.channelcount; num_channels = entry.channelcount;
sampling_frequency = entry.samplerate; sampling_frequency = entry.samplerate;
break; break;
case FOURCC_ac_3: case FOURCC_ac_3:
extra_data = entry.dac3.data; codec_config = entry.dac3.data;
num_channels = entry.channelcount; num_channels = entry.channelcount;
sampling_frequency = entry.samplerate; sampling_frequency = entry.samplerate;
break; break;
case FOURCC_ec_3: case FOURCC_ec_3:
extra_data = entry.dec3.data; codec_config = entry.dec3.data;
num_channels = entry.channelcount; num_channels = entry.channelcount;
sampling_frequency = entry.samplerate; sampling_frequency = entry.samplerate;
break; break;
case FOURCC_Opus: case FOURCC_Opus:
extra_data = entry.dops.opus_identification_header; codec_config = entry.dops.opus_identification_header;
num_channels = entry.channelcount; num_channels = entry.channelcount;
sampling_frequency = entry.samplerate; sampling_frequency = entry.samplerate;
RCHECK(sampling_frequency != 0); RCHECK(sampling_frequency != 0);
@ -486,8 +486,8 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
codec_delay_ns, codec_delay_ns,
max_bitrate, max_bitrate,
avg_bitrate, avg_bitrate,
extra_data.data(), codec_config.data(),
extra_data.size(), codec_config.size(),
is_encrypted)); is_encrypted));
} }

View File

@ -229,7 +229,7 @@ void MP4Muxer::GenerateVideoTrak(const VideoStreamInfo* video_info,
video.format = VideoCodecToFourCC(video_info->codec()); video.format = VideoCodecToFourCC(video_info->codec());
video.width = video_info->width(); video.width = video_info->width();
video.height = video_info->height(); video.height = video_info->height();
video.codec_configuration.data = video_info->extra_data(); video.codec_configuration.data = video_info->codec_config();
if (pixel_width != 1 || pixel_height != 1) { if (pixel_width != 1 || pixel_height != 1) {
video.pixel_aspect.h_spacing = pixel_width; video.pixel_aspect.h_spacing = pixel_width;
video.pixel_aspect.v_spacing = pixel_height; video.pixel_aspect.v_spacing = pixel_height;
@ -255,7 +255,7 @@ void MP4Muxer::GenerateAudioTrak(const AudioStreamInfo* audio_info,
audio.esds.es_descriptor.set_object_type(kISO_14496_3); // MPEG4 AAC. audio.esds.es_descriptor.set_object_type(kISO_14496_3); // MPEG4 AAC.
audio.esds.es_descriptor.set_esid(track_id); audio.esds.es_descriptor.set_esid(track_id);
audio.esds.es_descriptor.set_decoder_specific_info( audio.esds.es_descriptor.set_decoder_specific_info(
audio_info->extra_data()); audio_info->codec_config());
audio.esds.es_descriptor.set_max_bitrate(audio_info->max_bitrate()); audio.esds.es_descriptor.set_max_bitrate(audio_info->max_bitrate());
audio.esds.es_descriptor.set_avg_bitrate(audio_info->avg_bitrate()); audio.esds.es_descriptor.set_avg_bitrate(audio_info->avg_bitrate());
break; break;
@ -264,20 +264,20 @@ void MP4Muxer::GenerateAudioTrak(const AudioStreamInfo* audio_info,
case kCodecDTSL: case kCodecDTSL:
case kCodecDTSE: case kCodecDTSE:
case kCodecDTSM: case kCodecDTSM:
audio.ddts.extra_data = audio_info->extra_data(); audio.ddts.extra_data = audio_info->codec_config();
audio.ddts.max_bitrate = audio_info->max_bitrate(); audio.ddts.max_bitrate = audio_info->max_bitrate();
audio.ddts.avg_bitrate = audio_info->avg_bitrate(); audio.ddts.avg_bitrate = audio_info->avg_bitrate();
audio.ddts.sampling_frequency = audio_info->sampling_frequency(); audio.ddts.sampling_frequency = audio_info->sampling_frequency();
audio.ddts.pcm_sample_depth = audio_info->sample_bits(); audio.ddts.pcm_sample_depth = audio_info->sample_bits();
break; break;
case kCodecAC3: case kCodecAC3:
audio.dac3.data = audio_info->extra_data(); audio.dac3.data = audio_info->codec_config();
break; break;
case kCodecEAC3: case kCodecEAC3:
audio.dec3.data = audio_info->extra_data(); audio.dec3.data = audio_info->codec_config();
break; break;
case kCodecOpus: case kCodecOpus:
audio.dops.opus_identification_header = audio_info->extra_data(); audio.dops.opus_identification_header = audio_info->codec_config();
break; break;
default: default:
NOTIMPLEMENTED(); NOTIMPLEMENTED();

View File

@ -273,17 +273,17 @@ Status Segmenter::CreateVideoTrack(VideoStreamInfo* info) {
} else if (info->codec() == kCodecVP9) { } else if (info->codec() == kCodecVP9) {
track->set_codec_id(mkvmuxer::Tracks::kVp9CodecId); track->set_codec_id(mkvmuxer::Tracks::kVp9CodecId);
// The |StreamInfo::extra_data| field is stored using the MP4 format; we // The |StreamInfo::codec_config| field is stored using the MP4 format; we
// need to convert it to the WebM format. // need to convert it to the WebM format.
VPCodecConfigurationRecord vp_config; VPCodecConfigurationRecord vp_config;
if (!vp_config.ParseMP4(info->extra_data())) { if (!vp_config.ParseMP4(info->codec_config())) {
return Status(error::INTERNAL_ERROR, return Status(error::INTERNAL_ERROR,
"Unable to parse VP9 codec configuration"); "Unable to parse VP9 codec configuration");
} }
std::vector<uint8_t> extra_data; std::vector<uint8_t> codec_config;
vp_config.WriteWebM(&extra_data); vp_config.WriteWebM(&codec_config);
if (!track->SetCodecPrivate(extra_data.data(), extra_data.size())) { if (!track->SetCodecPrivate(codec_config.data(), codec_config.size())) {
return Status(error::INTERNAL_ERROR, return Status(error::INTERNAL_ERROR,
"Private codec data required for VP9 streams"); "Private codec data required for VP9 streams");
} }
@ -327,8 +327,8 @@ Status Segmenter::CreateAudioTrack(AudioStreamInfo* info) {
return Status(error::UNIMPLEMENTED, return Status(error::UNIMPLEMENTED,
"Only Vorbis and Opus audio codecs are supported."); "Only Vorbis and Opus audio codecs are supported.");
} }
if (!track->SetCodecPrivate(info->extra_data().data(), if (!track->SetCodecPrivate(info->codec_config().data(),
info->extra_data().size())) { info->codec_config().size())) {
return Status(error::INTERNAL_ERROR, return Status(error::INTERNAL_ERROR,
"Private codec data required for audio streams"); "Private codec data required for audio streams");
} }

View File

@ -60,11 +60,11 @@ scoped_refptr<AudioStreamInfo> WebMAudioClient::GetAudioStreamInfo(
sampling_frequency = 48000; sampling_frequency = 48000;
} }
const uint8_t* extra_data = NULL; const uint8_t* codec_config = NULL;
size_t extra_data_size = 0; size_t codec_config_size = 0;
if (codec_private.size() > 0) { if (codec_private.size() > 0) {
extra_data = &codec_private[0]; codec_config = &codec_private[0];
extra_data_size = codec_private.size(); codec_config_size = codec_private.size();
} }
const uint8_t kSampleSizeInBits = 16u; const uint8_t kSampleSizeInBits = 16u;
@ -73,7 +73,7 @@ scoped_refptr<AudioStreamInfo> WebMAudioClient::GetAudioStreamInfo(
AudioStreamInfo::GetCodecString(audio_codec, 0), language, AudioStreamInfo::GetCodecString(audio_codec, 0), language,
kSampleSizeInBits, channels_, sampling_frequency, kSampleSizeInBits, channels_, sampling_frequency,
seek_preroll < 0 ? 0 : seek_preroll, codec_delay < 0 ? 0 : codec_delay, 0, seek_preroll < 0 ? 0 : seek_preroll, codec_delay < 0 ? 0 : codec_delay, 0,
0, extra_data, extra_data_size, is_encrypted)); 0, codec_config, codec_config_size, is_encrypted));
} }
bool WebMAudioClient::OnUInt(int id, int64_t val) { bool WebMAudioClient::OnUInt(int id, int64_t val) {

View File

@ -457,15 +457,15 @@ bool WebMClusterParser::OnBlock(bool is_simple_block,
} }
VPCodecConfigurationRecord codec_config; VPCodecConfigurationRecord codec_config;
if (!video_stream_info_->extra_data().empty()) if (!video_stream_info_->codec_config().empty())
codec_config.ParseMP4(video_stream_info_->extra_data()); codec_config.ParseMP4(video_stream_info_->codec_config());
codec_config.MergeFrom(vpx_parser->codec_config()); codec_config.MergeFrom(vpx_parser->codec_config());
video_stream_info_->set_codec_string( video_stream_info_->set_codec_string(
codec_config.GetCodecString(video_stream_info_->codec())); codec_config.GetCodecString(video_stream_info_->codec()));
std::vector<uint8_t> extra_data; std::vector<uint8_t> config_serialized;
codec_config.WriteMP4(&extra_data); codec_config.WriteMP4(&config_serialized);
video_stream_info_->set_extra_data(extra_data); video_stream_info_->set_codec_config(config_serialized);
streams.push_back(video_stream_info_); streams.push_back(video_stream_info_);
init_cb_.Run(streams); init_cb_.Run(streams);
initialized_ = true; initialized_ = true;

View File

@ -273,8 +273,8 @@ TEST_F(WebVttMediaParserTest, BadComment) {
} }
MATCHER_P(HeaderMatches, header, "") { MATCHER_P(HeaderMatches, header, "") {
const std::vector<uint8_t>& extra_data = arg.at(0)->extra_data(); const std::vector<uint8_t>& codec_config = arg.at(0)->codec_config();
return extra_data == header; return codec_config == header;
} }
// Verify that the metadata header and the WEBVTT magic string is there. // Verify that the metadata header and the WEBVTT magic string is there.

View File

@ -834,14 +834,14 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
if (stream_infos_[i]->stream_type() == kStreamVideo && if (stream_infos_[i]->stream_type() == kStreamVideo &&
stream_infos_[i]->codec_string().empty()) { stream_infos_[i]->codec_string().empty()) {
const std::vector<uint8_t>* stream_config; const std::vector<uint8_t>* stream_config;
if (stream_infos_[i]->extra_data().empty()) { if (stream_infos_[i]->codec_config().empty()) {
// Decoder config record not available for stream. Use the one // Decoder config record not available for stream. Use the one
// computed from the first video stream. // computed from the first video stream.
stream_infos_[i]->set_extra_data(decoder_config_record); stream_infos_[i]->set_codec_config(decoder_config_record);
stream_config = &decoder_config_record; stream_config = &decoder_config_record;
} else { } else {
// Use stream-specific config record. // Use stream-specific config record.
stream_config = &stream_infos_[i]->extra_data(); stream_config = &stream_infos_[i]->codec_config();
} }
DCHECK(stream_config); DCHECK(stream_config);
@ -851,7 +851,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
if (!avc_config.Parse(*stream_config)) { if (!avc_config.Parse(*stream_config)) {
LOG(WARNING) << "Failed to parse AVCDecoderConfigurationRecord. " LOG(WARNING) << "Failed to parse AVCDecoderConfigurationRecord. "
"Using computed configuration record instead."; "Using computed configuration record instead.";
video_stream_info->set_extra_data(decoder_config_record); video_stream_info->set_codec_config(decoder_config_record);
if (!avc_config.Parse(decoder_config_record)) { if (!avc_config.Parse(decoder_config_record)) {
LOG(ERROR) << "Failed to parse AVCDecoderConfigurationRecord."; LOG(ERROR) << "Failed to parse AVCDecoderConfigurationRecord.";
return false; return false;
@ -912,7 +912,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
stream_infos_[i]->codec_string().empty()) { stream_infos_[i]->codec_string().empty()) {
AudioStreamInfo* audio_stream_info = AudioStreamInfo* audio_stream_info =
reinterpret_cast<AudioStreamInfo*>(stream_infos_[i].get()); reinterpret_cast<AudioStreamInfo*>(stream_infos_[i].get());
if (audio_stream_info->extra_data().empty()) { if (audio_stream_info->codec_config().empty()) {
// Set AudioStreamInfo fields using information from the ADTS // Set AudioStreamInfo fields using information from the ADTS
// header. // header.
audio_stream_info->set_sampling_frequency( audio_stream_info->set_sampling_frequency(
@ -922,7 +922,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
LOG(ERROR) << "Could not compute AACaudiospecificconfig"; LOG(ERROR) << "Could not compute AACaudiospecificconfig";
return false; return false;
} }
audio_stream_info->set_extra_data(audio_specific_config); audio_stream_info->set_codec_config(audio_specific_config);
audio_stream_info->set_codec_string( audio_stream_info->set_codec_string(
AudioStreamInfo::GetCodecString( AudioStreamInfo::GetCodecString(
kCodecAAC, adts_header.GetObjectType())); kCodecAAC, adts_header.GetObjectType()));
@ -930,7 +930,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
// Set AudioStreamInfo fields using information from the // Set AudioStreamInfo fields using information from the
// AACAudioSpecificConfig record. // AACAudioSpecificConfig record.
AACAudioSpecificConfig aac_config; AACAudioSpecificConfig aac_config;
if (!aac_config.Parse(stream_infos_[i]->extra_data())) { if (!aac_config.Parse(stream_infos_[i]->codec_config())) {
LOG(ERROR) << "Could not parse AACAudioSpecificconfig"; LOG(ERROR) << "Could not parse AACAudioSpecificconfig";
return false; return false;
} }
@ -947,7 +947,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) {
if (!is_initialized_) { if (!is_initialized_) {
bool all_streams_have_config = true; bool all_streams_have_config = true;
// Check if all collected stream infos have extra_data set. // Check if all collected stream infos have codec_config set.
for (uint32_t i = 0; i < stream_infos_.size(); i++) { for (uint32_t i = 0; i < stream_infos_.size(); i++) {
if (stream_infos_[i]->codec_string().empty()) { if (stream_infos_[i]->codec_string().empty()) {
all_streams_have_config = false; all_streams_have_config = false;