blob: f578989937168203538905e7aaad107de2c18a0c [file] [edit]
##########################################
Date: Aug 6, 2021 18:00 EST
From: ebecd56aaa2727b6305d39c69951fbdc8740f800 Aug 06, 2021 19:56 PM
Subject: DELIA-51340
Source: COMCAST
Upstream-Status: Pending
Signed-off-by: sivasubramanian <sivasubramanian.patchaiperumal@ltts.com>
##########################################
diff -urN a/Source/ocdm/adapter/broadcom-svp-secbuf/open_cdm_adapter.cpp b/Source/ocdm/adapter/broadcom-svp-secbuf/open_cdm_adapter.cpp
--- a/Source/ocdm/adapter/broadcom-svp-secbuf/open_cdm_adapter.cpp 2021-07-29 01:16:03.390053511 +0000
+++ b/Source/ocdm/adapter/broadcom-svp-secbuf/open_cdm_adapter.cpp 2021-08-06 23:57:09.701253187 +0000
@@ -52,12 +52,35 @@
struct Rpc_Secbuf_Info sb_info;
if (session != nullptr) {
+ if(subSampleBuffer == NULL && IV == NULL && keyID == NULL) {
+ // no encrypted data, skip decryption...
+ return(ERROR_NONE);
+ }
+
GstMapInfo dataMap;
if (gst_buffer_map(buffer, &dataMap, (GstMapFlags) GST_MAP_READWRITE) == false) {
fprintf(stderr, "Invalid buffer.\n");
return (ERROR_INVALID_DECRYPT_BUFFER);
}
+ // remove codec_data which can sometimes be too big (HBOMax -> 4000bytes)
+ // OCDM dataexchange has limit of 2048 bytes for IPC transfers
+ uint8_t* caps_str = NULL;
+ uint16_t caps_len = 0;
+
+ if (caps!=NULL && !gst_caps_is_empty(caps)) {
+ GstCaps *ret = gst_caps_copy (caps);
+ GstStructure *s = gst_caps_get_structure (ret, 0);
+ gst_structure_remove_field (s, "codec_data");
+ // Generate a GstCaps string for stream info in CDM module
+ if(!gst_caps_is_empty(ret)) {
+ caps_str = (uint8_t*)gst_caps_to_string(ret);
+ if(caps_str != nullptr)
+ caps_len = strlen((const char*)caps_str);
+ gst_caps_unref (ret);
+ }
+ }
+
GstMapInfo ivMap;
if (gst_buffer_map(IV, &ivMap, (GstMapFlags) GST_MAP_READ) == false) {
gst_buffer_unmap(buffer, &dataMap);
@@ -65,50 +88,39 @@
return (ERROR_INVALID_DECRYPT_BUFFER);
}
+ uint8_t *mappedKeyID = nullptr;
+ uint32_t mappedKeyIDSize = 0;
+
GstMapInfo keyIDMap;
- if (gst_buffer_map(keyID, &keyIDMap, (GstMapFlags) GST_MAP_READ) == false) {
+ if (keyID != nullptr) {
+ if (gst_buffer_map(keyID, &keyIDMap, (GstMapFlags) GST_MAP_READ) == false) {
gst_buffer_unmap(buffer, &dataMap);
gst_buffer_unmap(IV, &ivMap);
fprintf(stderr, "Invalid keyID buffer.\n");
return (ERROR_INVALID_DECRYPT_BUFFER);
- }
-
- // remove codec_data which can sometimes be too big (HBOMax -> 4000bytes)
- // OCDM dataexchange has limit of 2048 bytes for IPC transfers
- GstCaps *ret = gst_caps_copy (caps);
- GstStructure *s = gst_caps_get_structure (ret, 0);
- gst_structure_remove_field (s, "codec_data");
- // Generate a GstCaps string for stream info in CDM module
- uint8_t* caps_str = NULL;
- uint16_t caps_len = 0;
- if(ret != NULL) {
- caps_str = (uint8_t*)gst_caps_to_string(ret);
- if(caps_str != nullptr) {
- caps_len = strlen((const char*)caps_str);
- }
- }
- gst_caps_unref (ret);
+ }
+ mappedKeyID = reinterpret_cast<uint8_t* >(keyIDMap.data);
+ mappedKeyIDSize = static_cast<uint32_t >(keyIDMap.size);
+ }
uint8_t *mappedData = reinterpret_cast<uint8_t* >(dataMap.data);
uint32_t mappedDataSize = static_cast<uint32_t >(dataMap.size);
uint8_t *mappedIV = reinterpret_cast<uint8_t* >(ivMap.data);
uint32_t mappedIVSize = static_cast<uint32_t >(ivMap.size);
- uint8_t *mappedKeyID = reinterpret_cast<uint8_t* >(keyIDMap.data);
- uint32_t mappedKeyIDSize = static_cast<uint32_t >(keyIDMap.size);
-
if (subSampleBuffer != nullptr) {
GstMapInfo sampleMap;
if (gst_buffer_map(subSampleBuffer, &sampleMap, GST_MAP_READ) == false) {
fprintf(stderr, "Invalid subsample buffer.\n");
- gst_buffer_unmap(keyID, &keyIDMap);
+ if (keyID != nullptr) {
+ gst_buffer_unmap(keyID, &keyIDMap);
+ }
gst_buffer_unmap(IV, &ivMap);
gst_buffer_unmap(buffer, &dataMap);
return (ERROR_INVALID_DECRYPT_BUFFER);
}
uint8_t *mappedSubSample = reinterpret_cast<uint8_t* >(sampleMap.data);
uint32_t mappedSubSampleSize = static_cast<uint32_t >(sampleMap.size);
-
GstByteReader* reader = gst_byte_reader_new(mappedSubSample, mappedSubSampleSize);
uint16_t inClear = 0;
uint32_t inEncrypted = 0;
@@ -186,7 +198,10 @@
g_free(caps_str);
}
- gst_buffer_unmap(keyID, &keyIDMap);
+ if (keyID != nullptr) {
+ gst_buffer_unmap(keyID, &keyIDMap);
+ }
+
gst_buffer_unmap(IV, &ivMap);
gst_buffer_unmap(buffer, &dataMap);
}
diff -urN a/Source/ocdm/adapter/gstreamer/open_cdm_adapter.cpp b/Source/ocdm/adapter/gstreamer/open_cdm_adapter.cpp
--- a/Source/ocdm/adapter/gstreamer/open_cdm_adapter.cpp 2021-07-29 01:16:03.390053511 +0000
+++ b/Source/ocdm/adapter/gstreamer/open_cdm_adapter.cpp 2021-08-06 23:59:08.744961320 +0000
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
- * following copyright and licenses apply:
+ * following coiyright and licenses apply:
*
* Copyright 2020 RDK Management
*
@@ -40,12 +40,37 @@
OpenCDMError result (ERROR_INVALID_SESSION);
if (session != nullptr) {
+
+ if(subSampleBuffer == NULL && IV == NULL && keyID == NULL) {
+ // no encrypted data, skip decryption...
+ return(ERROR_NONE);
+ }
+
GstMapInfo dataMap;
if (gst_buffer_map(buffer, &dataMap, (GstMapFlags) GST_MAP_READWRITE) == false) {
printf("Invalid buffer.\n");
return (ERROR_INVALID_DECRYPT_BUFFER);
}
+ // remove codec_data which can sometimes be too big (HBOMax -> 4000bytes)
+ // OCDM dataexchange has limit of 2048 bytes for IPC transfers
+ uint8_t* caps_str = NULL;
+ uint16_t caps_len = 0;
+
+ if (caps!=NULL && !gst_caps_is_empty(caps)) {
+ GstCaps *ret = gst_caps_copy (caps);
+ GstStructure *s = gst_caps_get_structure (ret, 0);
+ gst_structure_remove_field (s, "codec_data");
+ // Generate a GstCaps string for stream info in CDM module
+ if(!gst_caps_is_empty(ret)) {
+ caps_str = (uint8_t*)gst_caps_to_string(ret);
+ if(caps_str != nullptr)
+ caps_len = strlen((const char*)caps_str);
+ gst_caps_unref (ret);
+ }
+ }
+
+
GstMapInfo ivMap;
if (gst_buffer_map(IV, &ivMap, (GstMapFlags) GST_MAP_READ) == false) {
gst_buffer_unmap(buffer, &dataMap);
@@ -71,20 +96,6 @@
// remove codec_data which can sometimes be too big (HBOMax -> 4000bytes)
// OCDM dataexchange has limit of 2048 bytes for IPC transfers
- GstCaps *ret = gst_caps_copy (caps);
- GstStructure *s = gst_caps_get_structure (ret, 0);
- gst_structure_remove_field (s, "codec_data");
- // Generate a GstCaps string for stream info in CDM module
- uint8_t* caps_str = NULL;
- uint16_t caps_len = 0;
- if(ret != NULL) {
- caps_str = (uint8_t*)gst_caps_to_string(ret);
- if(caps_str != nullptr) {
- caps_len = strlen((const char*)caps_str);
- }
- }
- gst_caps_unref (ret);
-
uint8_t *mappedData = reinterpret_cast<uint8_t* >(dataMap.data);
uint32_t mappedDataSize = static_cast<uint32_t >(dataMap.size);
uint8_t *mappedIV = reinterpret_cast<uint8_t* >(ivMap.data);