34 const std::string& codec_id,
35 const std::vector<uint8_t>& codec_private,
38 const std::string& language,
40 Codec audio_codec = kUnknownCodec;
41 if (codec_id ==
"A_VORBIS") {
42 audio_codec = kCodecVorbis;
43 }
else if (codec_id ==
"A_OPUS") {
44 audio_codec = kCodecOpus;
46 LOG(ERROR) <<
"Unsupported audio codec_id " << codec_id;
47 return std::shared_ptr<AudioStreamInfo>();
50 if (samples_per_second_ <= 0)
51 return std::shared_ptr<AudioStreamInfo>();
57 uint32_t sampling_frequency = samples_per_second_;
60 if (audio_codec == kCodecOpus) {
61 sampling_frequency = 48000;
64 const uint8_t* codec_config = NULL;
65 size_t codec_config_size = 0;
66 if (codec_private.size() > 0) {
67 codec_config = &codec_private[0];
68 codec_config_size = codec_private.size();
71 const uint8_t kSampleSizeInBits = 16u;
72 return std::make_shared<AudioStreamInfo>(
73 track_num, kWebMTimeScale, 0, audio_codec,
75 codec_config_size, kSampleSizeInBits, channels_, sampling_frequency,
76 seek_preroll < 0 ? 0 : seek_preroll, codec_delay < 0 ? 0 : codec_delay, 0,
77 0, language, is_encrypted);