MediaCodecsXmlParser: append variants instead of replacing
When adding variants for a codec, instead of replacing the existing
ones, append to that list.
MediaCodecXmlParser is first called for media_codecs.xml which has variants
for some of the codecs and then called for media_codecs_performance.xml
which may not contain variant information.
As the variants were replacing the existing ones, variants initilized from
media_codecs.xml were replaced by empty variants parsed from
media_codecs_performance.xml.
This caused an error in Codec2InfoBuilder.cpp as it didn't get the
variants from media_codecs.xml.
Bug: 368244438
Test: adb shell dumpsys media.player on slow-cpu device and verify
c2.android.vp9.encoder and c2.android.hevc.encoder are not listed.
Change-Id: Id04ac95eb87de9f13f304ed7fe7a8ff9f975d7d7
diff --git a/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
index 8c1ef3b..bd11326 100644
--- a/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
+++ b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
@@ -1069,7 +1069,7 @@
codec.rank = rank;
}
- codec.variantSet = variants;
+ codec.variantSet.insert(variants.begin(), variants.end());
// we allow sets of domains...
for (const std::string &domain : domains) {