From a1bac99f3bae78e510e367b61dd49a37e4301476 Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 4 Jan 2018 05:39:42 -0800 Subject: [PATCH] Fix loadDrmInitData given DASH manifest parser changes DASH manifests can now contain non-null but incomplete DRM init data. Hence using the manifest init data when non-null is not always the correct thing to do. This change merges the sample and manifest formats (which correctly merges the DRM init data) and then uses the result. Issue: #3630 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=180787784 --- .../android/exoplayer2/source/dash/DashUtil.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashUtil.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashUtil.java index ed2f916b879..57632225a50 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashUtil.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashUtil.java @@ -81,14 +81,11 @@ public static DrmInitData loadDrmInitData(DataSource dataSource, Period period) return null; } } - DrmInitData drmInitData = representation.format.drmInitData; - if (drmInitData != null) { - // Prefer drmInitData obtained from the manifest over drmInitData obtained from the stream, - // as per DASH IF Interoperability Recommendations V3.0, 7.5.3. - return drmInitData; - } + Format manifestFormat = representation.format; Format sampleFormat = DashUtil.loadSampleFormat(dataSource, primaryTrackType, representation); - return sampleFormat == null ? null : sampleFormat.drmInitData; + return sampleFormat == null + ? manifestFormat.drmInitData + : sampleFormat.copyWithManifestFormatInfo(manifestFormat).drmInitData; } /**