Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c67abec6 authored by Robert Shih's avatar Robert Shih
Browse files

Fix MediaExtractor.getDrmInitData implementation for webm

Should lookup "crypto-key" in individual track formats instead of file format.

Bug: 26070802
Change-Id: I1a0f59e7bca1d311631e7ad90b9a403ac20d319b
parent becc3019
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -275,8 +275,14 @@ final public class MediaExtractor {
                    return initDataMap.get(schemeUuid);
                }
            };
        } else if (formatMap.containsKey("crypto-key")) {
            ByteBuffer buf = (ByteBuffer) formatMap.get("crypto-key");
        } else {
            int numTracks = getTrackCount();
            for (int i = 0; i < numTracks; ++i) {
                Map<String, Object> trackFormatMap = getTrackFormatNative(i);
                if (!trackFormatMap.containsKey("crypto-key")) {
                    continue;
                }
                ByteBuffer buf = (ByteBuffer) trackFormatMap.get("crypto-key");
                buf.rewind();
                final byte[] data = new byte[buf.remaining()];
                buf.get(data);
@@ -286,6 +292,7 @@ final public class MediaExtractor {
                    }
                };
            }
        }
        return null;
    }