33 const std::string& codec_id,
34 const std::vector<uint8_t>& codec_private,
37 const std::string& language,
39 Codec audio_codec = kUnknownCodec;
40 if (codec_id ==
"A_VORBIS") {
41 audio_codec = kCodecVorbis;
42 }
else if (codec_id ==
"A_OPUS") {
43 audio_codec = kCodecOpus;
45 LOG(ERROR) <<
"Unsupported audio codec_id " << codec_id;
46 return std::shared_ptr<AudioStreamInfo>();
49 if (samples_per_second_ <= 0)
50 return std::shared_ptr<AudioStreamInfo>();
56 uint32_t sampling_frequency = samples_per_second_;
59 if (audio_codec == kCodecOpus) {
60 sampling_frequency = 48000;
63 const uint8_t* codec_config = NULL;
64 size_t codec_config_size = 0;
65 if (codec_private.size() > 0) {
66 codec_config = &codec_private[0];
67 codec_config_size = codec_private.size();
70 const uint8_t kSampleSizeInBits = 16u;
71 return std::make_shared<AudioStreamInfo>(
72 track_num, kWebMTimeScale, 0, audio_codec,
74 codec_config_size, kSampleSizeInBits, channels_, sampling_frequency,
75 seek_preroll < 0 ? 0 : seek_preroll, codec_delay < 0 ? 0 : codec_delay, 0,
76 0, language, is_encrypted);