From abb1abf5c5d7968366264fbf7a94a3d9f61e27c5 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Mon, 27 Jun 2016 12:30:32 -0700 Subject: [PATCH] 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 --- packager/media/base/audio_stream_info.cc | 8 ++++---- packager/media/base/audio_stream_info.h | 4 ++-- packager/media/base/stream_info.cc | 8 ++++---- packager/media/base/stream_info.h | 10 +++++----- packager/media/base/text_stream_info.cc | 6 +++--- packager/media/base/text_stream_info.h | 8 ++++---- packager/media/base/video_stream_info.cc | 8 ++++---- packager/media/base/video_stream_info.h | 4 ++-- packager/media/event/muxer_listener_internal.cc | 14 +++++++------- .../media/event/muxer_listener_test_helper.cc | 6 +++--- .../media/event/muxer_listener_test_helper.h | 2 +- packager/media/formats/mp2t/es_parser_adts.cc | 2 +- packager/media/formats/mp2t/es_parser_h264.cc | 4 ++-- packager/media/formats/mp2t/es_parser_h265.cc | 4 ++-- .../media/formats/mp2t/pes_packet_generator.cc | 6 +++--- packager/media/formats/mp2t/ts_writer.cc | 2 +- .../media/formats/mp4/encrypting_fragmenter.cc | 2 +- packager/media/formats/mp4/mp4_media_parser.cc | 16 ++++++++-------- packager/media/formats/mp4/mp4_muxer.cc | 12 ++++++------ packager/media/formats/webm/segmenter.cc | 14 +++++++------- packager/media/formats/webm/webm_audio_client.cc | 10 +++++----- .../media/formats/webm/webm_cluster_parser.cc | 10 +++++----- .../webvtt/webvtt_media_parser_unittest.cc | 4 ++-- packager/media/formats/wvm/wvm_media_parser.cc | 16 ++++++++-------- 24 files changed, 90 insertions(+), 90 deletions(-) diff --git a/packager/media/base/audio_stream_info.cc b/packager/media/base/audio_stream_info.cc index c950ffcd86..fbf96092c8 100644 --- a/packager/media/base/audio_stream_info.cc +++ b/packager/media/base/audio_stream_info.cc @@ -61,8 +61,8 @@ AudioStreamInfo::AudioStreamInfo(int track_id, uint64_t codec_delay_ns, uint32_t max_bitrate, uint32_t avg_bitrate, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted) : StreamInfo(kStreamAudio, track_id, @@ -70,8 +70,8 @@ AudioStreamInfo::AudioStreamInfo(int track_id, duration, codec_string, language, - extra_data, - extra_data_size, + codec_config, + codec_config_size, is_encrypted), codec_(codec), sample_bits_(sample_bits), diff --git a/packager/media/base/audio_stream_info.h b/packager/media/base/audio_stream_info.h index 17646cad61..e6bb0870a0 100644 --- a/packager/media/base/audio_stream_info.h +++ b/packager/media/base/audio_stream_info.h @@ -48,8 +48,8 @@ class AudioStreamInfo : public StreamInfo { uint64_t codec_delay_ns, uint32_t max_bitrate, uint32_t avg_bitrate, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted); /// @name StreamInfo implementation overrides. diff --git a/packager/media/base/stream_info.cc b/packager/media/base/stream_info.cc index 651e543a75..f883b99973 100644 --- a/packager/media/base/stream_info.cc +++ b/packager/media/base/stream_info.cc @@ -20,8 +20,8 @@ StreamInfo::StreamInfo(StreamType stream_type, uint64_t duration, const std::string& codec_string, const std::string& language, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted) : stream_type_(stream_type), track_id_(track_id), @@ -30,8 +30,8 @@ StreamInfo::StreamInfo(StreamType stream_type, codec_string_(codec_string), language_(language), is_encrypted_(is_encrypted) { - if (extra_data_size > 0) { - extra_data_.assign(extra_data, extra_data + extra_data_size); + if (codec_config_size > 0) { + codec_config_.assign(codec_config, codec_config + codec_config_size); } } diff --git a/packager/media/base/stream_info.h b/packager/media/base/stream_info.h index 701a195bc0..2ff325ddcb 100644 --- a/packager/media/base/stream_info.h +++ b/packager/media/base/stream_info.h @@ -31,8 +31,8 @@ class StreamInfo : public base::RefCountedThreadSafe { uint64_t duration, const std::string& codec_string, const std::string& language, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted); /// @return true if this object has appropriate configuration values, false @@ -51,11 +51,11 @@ class StreamInfo : public base::RefCountedThreadSafe { bool is_encrypted() const { return is_encrypted_; } - const std::vector& extra_data() const { return extra_data_; } + const std::vector& codec_config() const { return codec_config_; } void set_duration(int duration) { duration_ = duration; } - void set_extra_data(const std::vector& data) { extra_data_ = data; } + void set_codec_config(const std::vector& data) { codec_config_ = data; } void set_codec_string(const std::string& codec_string) { codec_string_ = codec_string; @@ -83,7 +83,7 @@ class StreamInfo : public base::RefCountedThreadSafe { bool is_encrypted_; // Optional byte data required for some audio/video decoders such as Vorbis // codebooks. - std::vector extra_data_; + std::vector codec_config_; // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler // generated copy constructor and assignment operator. Since the extra data is diff --git a/packager/media/base/text_stream_info.cc b/packager/media/base/text_stream_info.cc index 4c69db9cab..faa38ef7f7 100644 --- a/packager/media/base/text_stream_info.cc +++ b/packager/media/base/text_stream_info.cc @@ -14,7 +14,7 @@ TextStreamInfo::TextStreamInfo(int track_id, uint64_t duration, const std::string& codec_string, const std::string& language, - const std::string& extra_data, + const std::string& codec_config, uint16_t width, uint16_t height) : StreamInfo(kStreamText, @@ -23,8 +23,8 @@ TextStreamInfo::TextStreamInfo(int track_id, duration, codec_string, language, - reinterpret_cast(extra_data.data()), - extra_data.size(), + reinterpret_cast(codec_config.data()), + codec_config.size(), false), width_(width), height_(height) {} diff --git a/packager/media/base/text_stream_info.h b/packager/media/base/text_stream_info.h index 69a9ec0a3c..461533779d 100644 --- a/packager/media/base/text_stream_info.h +++ b/packager/media/base/text_stream_info.h @@ -22,9 +22,9 @@ class TextStreamInfo : public StreamInfo { /// @param duration is the duration of this stream. /// @param codec_string is the codec. /// @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 - /// metadata that applies to all the samples of this stream. This may - /// be empty. + /// @param codec_config is configuration for this text stream. This could be + /// the metadata that applies to all the samples of this stream. This + /// may be empty. /// @param width of the text. This may be 0. /// @param height of the text. This may be 0. TextStreamInfo(int track_id, @@ -32,7 +32,7 @@ class TextStreamInfo : public StreamInfo { uint64_t duration, const std::string& codec_string, const std::string& language, - const std::string& extra_data, + const std::string& codec_config, uint16_t width, uint16_t height); diff --git a/packager/media/base/video_stream_info.cc b/packager/media/base/video_stream_info.cc index 820e43b7c5..d1fc13e3b4 100644 --- a/packager/media/base/video_stream_info.cc +++ b/packager/media/base/video_stream_info.cc @@ -59,8 +59,8 @@ VideoStreamInfo::VideoStreamInfo(int track_id, uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted) : StreamInfo(kStreamVideo, track_id, @@ -68,8 +68,8 @@ VideoStreamInfo::VideoStreamInfo(int track_id, duration, codec_string, language, - extra_data, - extra_data_size, + codec_config, + codec_config_size, is_encrypted), codec_(codec), width_(width), diff --git a/packager/media/base/video_stream_info.h b/packager/media/base/video_stream_info.h index ad2e949e75..1c2978a0f9 100644 --- a/packager/media/base/video_stream_info.h +++ b/packager/media/base/video_stream_info.h @@ -45,8 +45,8 @@ class VideoStreamInfo : public StreamInfo { uint32_t pixel_height, int16_t trick_play_rate, uint8_t nalu_length_size, - const uint8_t* extra_data, - size_t extra_data_size, + const uint8_t* codec_config, + size_t codec_config_size, bool is_encrypted); /// @name StreamInfo implementation overrides. diff --git a/packager/media/event/muxer_listener_internal.cc b/packager/media/event/muxer_listener_internal.cc index c165d0df36..820f80dd4d 100644 --- a/packager/media/event/muxer_listener_internal.cc +++ b/packager/media/event/muxer_listener_internal.cc @@ -96,9 +96,9 @@ void AddVideoInfo(const VideoStreamInfo* video_stream_info, if (video_stream_info->pixel_height() > 0) video_info->set_pixel_height(video_stream_info->pixel_height()); - const std::vector& extra_data = video_stream_info->extra_data(); - if (!extra_data.empty()) { - video_info->set_decoder_config(&extra_data[0], extra_data.size()); + const std::vector& codec_config = video_stream_info->codec_config(); + if (!codec_config.empty()) { + 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); } - const std::vector& extra_data = audio_stream_info->extra_data(); - if (!extra_data.empty()) { - audio_info->set_decoder_config(&extra_data[0], extra_data.size()); + const std::vector& codec_config = audio_stream_info->codec_config(); + if (!codec_config.empty()) { + audio_info->set_decoder_config(&codec_config[0], codec_config.size()); } if (audio_stream_info->codec_string() == "ec-3") { 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."; return; } diff --git a/packager/media/event/muxer_listener_test_helper.cc b/packager/media/event/muxer_listener_test_helper.cc index ce989adda2..59ab969152 100644 --- a/packager/media/event/muxer_listener_test_helper.cc +++ b/packager/media/event/muxer_listener_test_helper.cc @@ -29,8 +29,8 @@ scoped_refptr CreateVideoStreamInfo( param.pixel_height, 0, // trick_play_rate param.nalu_length_size, - param.extra_data.data(), - param.extra_data.size(), + param.codec_config.data(), + param.codec_config.size(), param.is_encrypted)); } @@ -60,7 +60,7 @@ VideoStreamInfoParameters GetDefaultVideoStreamInfoParams() { params.pixel_width = kPixelWidth; params.pixel_height = kPixelHeight; params.nalu_length_size = kNaluLengthSize; - params.extra_data = kExtraData; + params.codec_config = kExtraData; params.is_encrypted = kEncryptedFlag; return params; } diff --git a/packager/media/event/muxer_listener_test_helper.h b/packager/media/event/muxer_listener_test_helper.h index d412e7f909..f17af435c7 100644 --- a/packager/media/event/muxer_listener_test_helper.h +++ b/packager/media/event/muxer_listener_test_helper.h @@ -68,7 +68,7 @@ struct VideoStreamInfoParameters { uint32_t pixel_width; uint32_t pixel_height; uint8_t nalu_length_size; - std::vector extra_data; + std::vector codec_config; bool is_encrypted; }; diff --git a/packager/media/formats/mp2t/es_parser_adts.cc b/packager/media/formats/mp2t/es_parser_adts.cc index 75f102bb80..0234d9f650 100644 --- a/packager/media/formats/mp2t/es_parser_adts.cc +++ b/packager/media/formats/mp2t/es_parser_adts.cc @@ -205,7 +205,7 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_frame, if (last_audio_decoder_config_) { // 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. return true; } diff --git a/packager/media/formats/mp2t/es_parser_h264.cc b/packager/media/formats/mp2t/es_parser_h264.cc index 1aca695c77..2a5d946563 100644 --- a/packager/media/formats/mp2t/es_parser_h264.cc +++ b/packager/media/formats/mp2t/es_parser_h264.cc @@ -121,14 +121,14 @@ bool EsParserH264::UpdateVideoDecoderConfig(int pps_id) { } 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. // TODO(tinskip): Check the nature of the configuration change. Only // minor configuration changes (such as frame ordering) can be handled // gracefully by decoders without notification. Major changes (such as // video resolution changes) should be treated as errors. 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; } diff --git a/packager/media/formats/mp2t/es_parser_h265.cc b/packager/media/formats/mp2t/es_parser_h265.cc index ceb101ac45..3b67c7f575 100644 --- a/packager/media/formats/mp2t/es_parser_h265.cc +++ b/packager/media/formats/mp2t/es_parser_h265.cc @@ -126,14 +126,14 @@ bool EsParserH265::UpdateVideoDecoderConfig(int pps_id) { } 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. // TODO(tinskip): Check the nature of the configuration change. Only // minor configuration changes (such as frame ordering) can be handled // gracefully by decoders without notification. Major changes (such as // video resolution changes) should be treated as errors. 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; } diff --git a/packager/media/formats/mp2t/pes_packet_generator.cc b/packager/media/formats/mp2t/pes_packet_generator.cc index 388c681c34..9cb9361bd3 100644 --- a/packager/media/formats/mp2t/pes_packet_generator.cc +++ b/packager/media/formats/mp2t/pes_packet_generator.cc @@ -104,8 +104,8 @@ bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) { } timescale_scale_ = kTsTimescale / video_stream_info.time_scale(); converter_.reset(new NalUnitToByteStreamConverter()); - return converter_->Initialize(video_stream_info.extra_data().data(), - video_stream_info.extra_data().size(), + return converter_->Initialize(video_stream_info.codec_config().data(), + video_stream_info.codec_config().size(), !kEscapeData); } else if (stream_type_ == kStreamAudio) { const AudioStreamInfo& audio_stream_info = @@ -117,7 +117,7 @@ bool PesPacketGenerator::Initialize(const StreamInfo& stream_info) { } timescale_scale_ = kTsTimescale / audio_stream_info.time_scale(); 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."; diff --git a/packager/media/formats/mp2t/ts_writer.cc b/packager/media/formats/mp2t/ts_writer.cc index 8082e4003f..5f2ba97dde 100644 --- a/packager/media/formats/mp2t/ts_writer.cc +++ b/packager/media/formats/mp2t/ts_writer.cc @@ -191,7 +191,7 @@ bool TsWriter::Initialize(const StreamInfo& stream_info, return false; } 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; diff --git a/packager/media/formats/mp4/encrypting_fragmenter.cc b/packager/media/formats/mp4/encrypting_fragmenter.cc index 7300586bf8..46fd66fd30 100644 --- a/packager/media/formats/mp4/encrypting_fragmenter.cc +++ b/packager/media/formats/mp4/encrypting_fragmenter.cc @@ -122,7 +122,7 @@ Status EncryptingFragmenter::InitializeFragment(int64_t first_sample_dts) { if (!status.ok()) 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."); traf()->auxiliary_size.sample_info_sizes.clear(); diff --git a/packager/media/formats/mp4/mp4_media_parser.cc b/packager/media/formats/mp4/mp4_media_parser.cc index 5f1dbbec4a..a6c58b3500 100644 --- a/packager/media/formats/mp4/mp4_media_parser.cc +++ b/packager/media/formats/mp4/mp4_media_parser.cc @@ -350,7 +350,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { uint8_t audio_object_type = 0; uint32_t max_bitrate = 0; uint32_t avg_bitrate = 0; - std::vector extra_data; + std::vector codec_config; switch (actual_format) { case FOURCC_mp4a: @@ -363,7 +363,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { num_channels = aac_audio_specific_config.num_channels(); sampling_frequency = aac_audio_specific_config.frequency(); 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; } else if (entry.esds.es_descriptor.IsDTS()) { ObjectType audio_type = entry.esds.es_descriptor.object_type(); @@ -411,24 +411,24 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { case FOURCC_dtse: FALLTHROUGH_INTENDED; case FOURCC_dtsm: - extra_data = entry.ddts.extra_data; + codec_config = entry.ddts.extra_data; max_bitrate = entry.ddts.max_bitrate; avg_bitrate = entry.ddts.avg_bitrate; num_channels = entry.channelcount; sampling_frequency = entry.samplerate; break; case FOURCC_ac_3: - extra_data = entry.dac3.data; + codec_config = entry.dac3.data; num_channels = entry.channelcount; sampling_frequency = entry.samplerate; break; case FOURCC_ec_3: - extra_data = entry.dec3.data; + codec_config = entry.dec3.data; num_channels = entry.channelcount; sampling_frequency = entry.samplerate; break; case FOURCC_Opus: - extra_data = entry.dops.opus_identification_header; + codec_config = entry.dops.opus_identification_header; num_channels = entry.channelcount; sampling_frequency = entry.samplerate; RCHECK(sampling_frequency != 0); @@ -486,8 +486,8 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) { codec_delay_ns, max_bitrate, avg_bitrate, - extra_data.data(), - extra_data.size(), + codec_config.data(), + codec_config.size(), is_encrypted)); } diff --git a/packager/media/formats/mp4/mp4_muxer.cc b/packager/media/formats/mp4/mp4_muxer.cc index 2c11dcbb3f..18ab3aacd9 100644 --- a/packager/media/formats/mp4/mp4_muxer.cc +++ b/packager/media/formats/mp4/mp4_muxer.cc @@ -229,7 +229,7 @@ void MP4Muxer::GenerateVideoTrak(const VideoStreamInfo* video_info, video.format = VideoCodecToFourCC(video_info->codec()); video.width = video_info->width(); 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) { video.pixel_aspect.h_spacing = pixel_width; 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_esid(track_id); 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_avg_bitrate(audio_info->avg_bitrate()); break; @@ -264,20 +264,20 @@ void MP4Muxer::GenerateAudioTrak(const AudioStreamInfo* audio_info, case kCodecDTSL: case kCodecDTSE: 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.avg_bitrate = audio_info->avg_bitrate(); audio.ddts.sampling_frequency = audio_info->sampling_frequency(); audio.ddts.pcm_sample_depth = audio_info->sample_bits(); break; case kCodecAC3: - audio.dac3.data = audio_info->extra_data(); + audio.dac3.data = audio_info->codec_config(); break; case kCodecEAC3: - audio.dec3.data = audio_info->extra_data(); + audio.dec3.data = audio_info->codec_config(); break; case kCodecOpus: - audio.dops.opus_identification_header = audio_info->extra_data(); + audio.dops.opus_identification_header = audio_info->codec_config(); break; default: NOTIMPLEMENTED(); diff --git a/packager/media/formats/webm/segmenter.cc b/packager/media/formats/webm/segmenter.cc index 8f63e7f97d..d4c40114b9 100644 --- a/packager/media/formats/webm/segmenter.cc +++ b/packager/media/formats/webm/segmenter.cc @@ -273,17 +273,17 @@ Status Segmenter::CreateVideoTrack(VideoStreamInfo* info) { } else if (info->codec() == kCodecVP9) { 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. VPCodecConfigurationRecord vp_config; - if (!vp_config.ParseMP4(info->extra_data())) { + if (!vp_config.ParseMP4(info->codec_config())) { return Status(error::INTERNAL_ERROR, "Unable to parse VP9 codec configuration"); } - std::vector extra_data; - vp_config.WriteWebM(&extra_data); - if (!track->SetCodecPrivate(extra_data.data(), extra_data.size())) { + std::vector codec_config; + vp_config.WriteWebM(&codec_config); + if (!track->SetCodecPrivate(codec_config.data(), codec_config.size())) { return Status(error::INTERNAL_ERROR, "Private codec data required for VP9 streams"); } @@ -327,8 +327,8 @@ Status Segmenter::CreateAudioTrack(AudioStreamInfo* info) { return Status(error::UNIMPLEMENTED, "Only Vorbis and Opus audio codecs are supported."); } - if (!track->SetCodecPrivate(info->extra_data().data(), - info->extra_data().size())) { + if (!track->SetCodecPrivate(info->codec_config().data(), + info->codec_config().size())) { return Status(error::INTERNAL_ERROR, "Private codec data required for audio streams"); } diff --git a/packager/media/formats/webm/webm_audio_client.cc b/packager/media/formats/webm/webm_audio_client.cc index ead2c22cf7..7a962268b0 100644 --- a/packager/media/formats/webm/webm_audio_client.cc +++ b/packager/media/formats/webm/webm_audio_client.cc @@ -60,11 +60,11 @@ scoped_refptr WebMAudioClient::GetAudioStreamInfo( sampling_frequency = 48000; } - const uint8_t* extra_data = NULL; - size_t extra_data_size = 0; + const uint8_t* codec_config = NULL; + size_t codec_config_size = 0; if (codec_private.size() > 0) { - extra_data = &codec_private[0]; - extra_data_size = codec_private.size(); + codec_config = &codec_private[0]; + codec_config_size = codec_private.size(); } const uint8_t kSampleSizeInBits = 16u; @@ -73,7 +73,7 @@ scoped_refptr WebMAudioClient::GetAudioStreamInfo( AudioStreamInfo::GetCodecString(audio_codec, 0), language, kSampleSizeInBits, channels_, sampling_frequency, 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) { diff --git a/packager/media/formats/webm/webm_cluster_parser.cc b/packager/media/formats/webm/webm_cluster_parser.cc index 946c6a3aa9..9d3850e98d 100644 --- a/packager/media/formats/webm/webm_cluster_parser.cc +++ b/packager/media/formats/webm/webm_cluster_parser.cc @@ -457,15 +457,15 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, } VPCodecConfigurationRecord codec_config; - if (!video_stream_info_->extra_data().empty()) - codec_config.ParseMP4(video_stream_info_->extra_data()); + if (!video_stream_info_->codec_config().empty()) + codec_config.ParseMP4(video_stream_info_->codec_config()); codec_config.MergeFrom(vpx_parser->codec_config()); video_stream_info_->set_codec_string( codec_config.GetCodecString(video_stream_info_->codec())); - std::vector extra_data; - codec_config.WriteMP4(&extra_data); - video_stream_info_->set_extra_data(extra_data); + std::vector config_serialized; + codec_config.WriteMP4(&config_serialized); + video_stream_info_->set_codec_config(config_serialized); streams.push_back(video_stream_info_); init_cb_.Run(streams); initialized_ = true; diff --git a/packager/media/formats/webvtt/webvtt_media_parser_unittest.cc b/packager/media/formats/webvtt/webvtt_media_parser_unittest.cc index eefc1591db..4bfdc251d5 100644 --- a/packager/media/formats/webvtt/webvtt_media_parser_unittest.cc +++ b/packager/media/formats/webvtt/webvtt_media_parser_unittest.cc @@ -273,8 +273,8 @@ TEST_F(WebVttMediaParserTest, BadComment) { } MATCHER_P(HeaderMatches, header, "") { - const std::vector& extra_data = arg.at(0)->extra_data(); - return extra_data == header; + const std::vector& codec_config = arg.at(0)->codec_config(); + return codec_config == header; } // Verify that the metadata header and the WEBVTT magic string is there. diff --git a/packager/media/formats/wvm/wvm_media_parser.cc b/packager/media/formats/wvm/wvm_media_parser.cc index 3d0fd7f5c9..a543e3ff43 100644 --- a/packager/media/formats/wvm/wvm_media_parser.cc +++ b/packager/media/formats/wvm/wvm_media_parser.cc @@ -834,14 +834,14 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { if (stream_infos_[i]->stream_type() == kStreamVideo && stream_infos_[i]->codec_string().empty()) { const std::vector* 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 // 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; } else { // Use stream-specific config record. - stream_config = &stream_infos_[i]->extra_data(); + stream_config = &stream_infos_[i]->codec_config(); } DCHECK(stream_config); @@ -851,7 +851,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { if (!avc_config.Parse(*stream_config)) { LOG(WARNING) << "Failed to parse AVCDecoderConfigurationRecord. " "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)) { LOG(ERROR) << "Failed to parse AVCDecoderConfigurationRecord."; return false; @@ -912,7 +912,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { stream_infos_[i]->codec_string().empty()) { AudioStreamInfo* audio_stream_info = reinterpret_cast(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 // header. audio_stream_info->set_sampling_frequency( @@ -922,7 +922,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { LOG(ERROR) << "Could not compute AACaudiospecificconfig"; 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( AudioStreamInfo::GetCodecString( kCodecAAC, adts_header.GetObjectType())); @@ -930,7 +930,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { // Set AudioStreamInfo fields using information from the // AACAudioSpecificConfig record. 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"; return false; } @@ -947,7 +947,7 @@ bool WvmMediaParser::Output(bool output_encrypted_sample) { if (!is_initialized_) { 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++) { if (stream_infos_[i]->codec_string().empty()) { all_streams_have_config = false;