42 const std::string& codec_id,
43 const std::vector<uint8_t>& codec_private,
46 const std::string& language,
48 Codec audio_codec = kUnknownCodec;
49 if (codec_id ==
"A_VORBIS") {
50 audio_codec = kCodecVorbis;
51 }
else if (codec_id ==
"A_OPUS") {
52 audio_codec = kCodecOpus;
54 LOG(ERROR) <<
"Unsupported audio codec_id " << codec_id;
55 return std::shared_ptr<AudioStreamInfo>();
58 if (samples_per_second_ <= 0)
59 return std::shared_ptr<AudioStreamInfo>();
65 uint32_t sampling_frequency = samples_per_second_;
68 if (audio_codec == kCodecOpus) {
69 sampling_frequency = 48000;
72 const uint8_t* codec_config = NULL;
73 size_t codec_config_size = 0;
74 if (codec_private.size() > 0) {
75 codec_config = &codec_private[0];
76 codec_config_size = codec_private.size();
79 const uint8_t kSampleSizeInBits = 16u;
80 return std::make_shared<AudioStreamInfo>(
81 track_num, kWebMTimeScale, 0, audio_codec,
83 codec_config_size, kSampleSizeInBits, channels_, sampling_frequency,
84 seek_preroll < 0 ? 0 : seek_preroll, codec_delay < 0 ? 0 : codec_delay, 0,
85 0, language, is_encrypted);