Skip to content

Commit

Permalink
Set correct Content-Type for ClearKey requests
Browse files Browse the repository at this point in the history
Issue: #3138

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164434858
  • Loading branch information
ojw28 committed Aug 7, 2017
1 parent d4c4586 commit 05179b4
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@
@TargetApi(18)
public final class HttpMediaDrmCallback implements MediaDrmCallback {

private static final Map<String, String> PLAYREADY_KEY_REQUEST_PROPERTIES;
static {
PLAYREADY_KEY_REQUEST_PROPERTIES = new HashMap<>();
PLAYREADY_KEY_REQUEST_PROPERTIES.put("Content-Type", "text/xml");
PLAYREADY_KEY_REQUEST_PROPERTIES.put("SOAPAction",
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
}

private final HttpDataSource.Factory dataSourceFactory;
private final String defaultUrl;
private final Map<String, String> keyRequestProperties;
Expand Down Expand Up @@ -124,10 +116,15 @@ public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception
url = defaultUrl;
}
Map<String, String> requestProperties = new HashMap<>();
requestProperties.put("Content-Type", "application/octet-stream");
// Add standard request properties for supported schemes.
String contentType = C.PLAYREADY_UUID.equals(uuid) ? "text/xml"
: (C.CLEARKEY_UUID.equals(uuid) ? "application/json" : "application/octet-stream");
requestProperties.put("Content-Type", contentType);
if (C.PLAYREADY_UUID.equals(uuid)) {
requestProperties.putAll(PLAYREADY_KEY_REQUEST_PROPERTIES);
requestProperties.put("SOAPAction",
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
}
// Add additional request properties.
synchronized (keyRequestProperties) {
requestProperties.putAll(keyRequestProperties);
}
Expand Down

0 comments on commit 05179b4

Please sign in to comment.