mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-15 16:06:41 +03:00
feat(MediaCap): Support multiplex content with MediaCap
If we have a multiplexd content with audio and video, we combine the audio and video codecs in the manifest parser. For example, a multiplexed stream would be with: mimeType="video/mp4", codecs="avc1.64001e,mp4a.40.2". When sending the request to MediaCapabilities.decodingInfo(), we need to have the config for both audio and video to get the result as "supported". The video config would be: contentType='video/mp4, codecs="avc1.64001e"'. The audio config would be: contentType='audio/mp4, codecs="mp4a.40.2"'. Issue #1391 Change-Id: I74a8580c07228e9600dc40c611ebd5d34f8cd7ee
This commit is contained in:
@@ -374,8 +374,25 @@ shaka.util.StreamUtils = class {
|
||||
};
|
||||
|
||||
if (video) {
|
||||
let audioCodec;
|
||||
let videoCodec = video.codecs;
|
||||
|
||||
// For multiplexed streams with audio+video codecs, the config should have
|
||||
// AudioConfiguration and VideoConfiguration.
|
||||
if (video.codecs.includes(',')) {
|
||||
[videoCodec, audioCodec] = video.codecs.split(',');
|
||||
const audioFullType = shaka.util.MimeUtils.getFullOrConvertedType(
|
||||
video.mimeType, audioCodec, ContentType.AUDIO);
|
||||
mediaDecodingConfig['audio'] = {
|
||||
contentType: audioFullType,
|
||||
channels: 2,
|
||||
bitrate: variant.bandwidth || 1,
|
||||
samplerate: 1,
|
||||
spatialRendering: false,
|
||||
};
|
||||
}
|
||||
const fullType = shaka.util.MimeUtils.getFullOrConvertedType(
|
||||
video.mimeType, video.codecs, ContentType.VIDEO);
|
||||
video.mimeType, videoCodec, ContentType.VIDEO);
|
||||
// VideoConfiguration
|
||||
mediaDecodingConfig['video'] = {
|
||||
contentType: fullType,
|
||||
|
||||
@@ -464,6 +464,24 @@ describe('StreamUtils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getDecodingInfosForVariants', () => {
|
||||
it('for multiplexd content', async () => {
|
||||
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
||||
manifest.addVariant(0, (variant) => {
|
||||
variant.addVideo(1, (stream) => {
|
||||
stream.mime('video/mp2t', 'avc1.4d400d,mp4a.40.2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
await shaka.util.StreamUtils.getDecodingInfosForVariants(
|
||||
manifest.variants);
|
||||
expect(manifest.variants.length).toBeTruthy();
|
||||
expect(manifest.variants[0].decodingInfos.length).toBe(1);
|
||||
expect(manifest.variants[0].decodingInfos[0].supported).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('filterManifest', () => {
|
||||
let fakeDrmEngine;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user