Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: media/base/audio_codecs.cc

Issue 2226443002: Support multiple media tracks in MSE / ChunkDemuxer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mp4 format is not supported on some trybots, so use webm Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/audio_codecs.cc
diff --git a/media/base/audio_codecs.cc b/media/base/audio_codecs.cc
index 46a7b2510fa2f4dc7beed613ca99932acd703aa2..8aaa24f0394af4f52b22baed786c9c1ba1881212 100644
--- a/media/base/audio_codecs.cc
+++ b/media/base/audio_codecs.cc
@@ -5,6 +5,7 @@
#include "media/base/audio_codecs.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
namespace media {
@@ -48,4 +49,26 @@ std::string GetCodecName(AudioCodec codec) {
return "";
}
+AudioCodec StringToAudioCodec(const std::string& codec_id) {
+ if (codec_id == "aac")
+ return kCodecAAC;
+ if (codec_id == "ac-3" || codec_id == "mp4a.A5")
+ return kCodecAC3;
+ if (codec_id == "ec-3" || codec_id == "mp4a.A6")
+ return kCodecEAC3;
+ if (codec_id == "mp3")
+ return kCodecMP3;
+ if (codec_id == "alac")
+ return kCodecALAC;
+ if (codec_id == "flac")
+ return kCodecFLAC;
+ if (codec_id == "opus")
+ return kCodecOpus;
+ if (codec_id == "vorbis")
+ return kCodecVorbis;
+ if (base::StartsWith(codec_id, "mp4a.40.", base::CompareCase::SENSITIVE))
+ return kCodecAAC;
+ return kUnknownAudioCodec;
+}
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698