From b65cce78266767278f0823739aa2666009a86d12 Mon Sep 17 00:00:00 2001 From: lashmintha Date: Tue, 18 Nov 2025 14:26:49 +0530 Subject: [PATCH] VPLAY-11225 [Tech Debt] mediafailed event enhancements ( minor code etc ) Reason for change: Added minor code for MediaFailedEvent Risks: Low Test Procedure: Refer jira ticket Priority: P1 Signed-off-by: lashmintha --- AAMP-UVE-API.md | 85 +++++++------ AampEvent.cpp | 22 +++- AampEvent.h | 107 ++++++++++------ AampEventListener.cpp | 3 +- jsbindings/jsbindings.cpp | 8 +- jsbindings/jseventlistener.cpp | 6 +- priv_aamp.cpp | 120 +++++++++++------- test/aampcli/Aampcli.cpp | 2 +- test/utests/fakes/FakeAampEvent.cpp | 5 +- .../tests/AampEventTests/AampEventTests.cpp | 80 +++++++++++- 10 files changed, 295 insertions(+), 143 deletions(-) diff --git a/AAMP-UVE-API.md b/AAMP-UVE-API.md index 6a60bb6f1..98fb47216 100644 --- a/AAMP-UVE-API.md +++ b/AAMP-UVE-API.md @@ -2439,46 +2439,51 @@ When a player instance is no longer needed, recommend to call explicit release() ## Universal Video Engine Player Errors -| Error Code | Code | Error String | -| ---- | ---- | ----- | -| AAMP_TUNE_INIT_FAILED | 10 | AAMP: init failed | -| AAMP_TUNE_INIT_FAILED_MANIFEST_DNLD_ERROR | 10 | AAMP: init failed (unable to download manifest) | -| AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR | 10 | AAMP: init failed (manifest missing tracks) | -| AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR | 10 | AAMP: init failed (corrupt/invalid manifest) | -| AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR | 10 | AAMP: init failed (unsynchronized tracks) | -| AAMP_TUNE_MANIFEST_REQ_FAILED | 10 | AAMP: Manifest Download failed; Playlist refresh failed | -| AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR | 10 | AAMP: init failed (unable to download video playlist) | -| AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR | 10 | AAMP: init failed (unable to download audio playlist) | -| AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE | 10 | AAMP: fragment download failures | -| AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE | 10 | AAMP: init fragment download failed | -| AAMP_TUNE_INVALID_MANIFEST_FAILURE | 10 | AAMP: Invalid Manifest, parse failed | -| AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING | 10 | AAMP: init fragments missing in playlist | -| AAMP_TUNE_CONTENT_NOT_FOUND | 20 | AAMP: Resource was not found at the URL(HTTP 404) | -| AAMP_TUNE_AUTHORIZATION_FAILURE | 40 | AAMP: Authorization failure | -| AAMP_TUNE_UNTRACKED_DRM_ERROR | 50 | AAMP: DRM error untracked error | -| AAMP_TUNE_DRM_INIT_FAILED | 50 | AAMP: DRM Initialization Failed | -| AAMP_TUNE_DRM_DATA_BIND_FAILED | 50 | AAMP: InitData-DRM Binding Failed | -| AAMP_TUNE_DRM_SESSIONID_EMPTY | 50 | AAMP: DRM Session ID Empty | -| AAMP_TUNE_DRM_CHALLENGE_FAILED | 50 | AAMP: DRM License Challenge Generation Failed | -| AAMP_TUNE_LICENCE_TIMEOUT | 50 | AAMP: DRM License Request Timed out | -| AAMP_TUNE_LICENCE_REQUEST_FAILED | 50 | AAMP: DRM License Request Failed | -| AAMP_TUNE_INVALID_DRM_KEY | 50 | AAMP: Invalid Key Error, from DRM | -| AAMP_TUNE_UNSUPPORTED_STREAM_TYPE | 60 | AAMP: Unsupported Stream Type. Unable to determine stream type for DRM Init | -| AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE | 60 | AAMP: No supported Audio Types in Manifest | -| AAMP_TUNE_FAILED_TO_GET_KEYID | 50 | AAMP: Failed to parse key id from PSSH | -| AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN | 50 | AAMP: Failed to get access token from Auth Service | -| AAMP_TUNE_CORRUPT_DRM_METADATA | 50 | AAMP: DRM failure due to Bad DRMMetadata in stream | -| AAMP_TUNE_DRM_DECRYPT_FAILED | 50 | AAMP: DRM Decryption Failed for Fragments | -| AAMP_TUNE_DRM_UNSUPPORTED | 50 | AAMP: DRM format Unsupported | -| AAMP_TUNE_DRM_SELF_ABORT | 50 | AAMP: DRM license request aborted by player | -| AAMP_TUNE_DRM_KEY_UPDATE_FAILED | 50 | AAMP: Failed to process DRM key | -| AAMP_TUNE_CORRUPT_DRM_DATA | 51 | AAMP: DRM failure due to Corrupt DRM files | -| AAMP_TUNE_DEVICE_NOT_PROVISIONED | 52 | AAMP: Device not provisioned | -| AAMP_TUNE_HDCP_COMPLIANCE_ERROR | 53 | AAMP: HDCP Compliance Check Failure | -| AAMP_TUNE_GST_PIPELINE_ERROR | 80 | AAMP: Error from gstreamer pipeline | -| AAMP_TUNE_FAILED_PTS_ERROR | 80 | AAMP: Playback failed due to PTS error | -| AAMP_TUNE_PLAYBACK_STALLED | 7600 | AAMP: Playback was stalled due to lack of new fragments | -| AAMP_TUNE_FAILURE_UNKNOWN | 100 | AAMP: Unknown Failure | +| Error Code | Code | MinorCode | Error String | +| ---- | ---- | ----- | ----- | +| AAMP_TUNE_INIT_FAILED | 10 | 1001 | AAMP: init failed | +| AAMP_TUNE_INIT_FAILED_MANIFEST_DNLD_ERROR | 10 | 1002 | AAMP: init failed (unable to download manifest) | +| AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR | 10 | 1003 | AAMP: init failed (manifest missing tracks) | +| AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR | 10 | 1004 | AAMP: init failed (corrupt/invalid manifest) | +| AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR | 10 | 1005 | AAMP: init failed (unable to download video playlist) | +| AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR | 10 | 1006 | AAMP: init failed (unable to download audio playlist) | +| AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR | 10 | 1007 | AAMP: init failed (unsynchronized tracks) | +| AAMP_TUNE_CONTENT_NOT_FOUND | 20 | 2001 | AAMP: Resource was not found at the URL(HTTP 404) | +| AAMP_TUNE_MANIFEST_REQ_FAILED | 30 | 3001 | AAMP: Manifest Download failed | +| AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE | 30 | 3002 | AAMP: fragment download failures | +| AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE | 30 | 3003 | AAMP: init fragment download failed | +| AAMP_TUNE_INVALID_MANIFEST_FAILURE | 30 | 3004 | AAMP: Invalid Manifest, parse failed | +| AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING | 30 | 3005 | AAMP: init fragments missing in playlist | +| AAMP_TUNE_DNS_RESOLVE_TIMEOUT | 30 | 3006 | AAMP: Manifest download failed due to DNS resolve timeout | +| AAMP_TUNE_CURL_CONNECTION_TIMEOUT | 30 | 3007 | AAMP: Manifest download failed due to connection timeout | +| AAMP_TUNE_DATA_TRANSFER_TIMEOUT | 30 | 3008 | AAMP: Manifest download failed due to data transfer timeout | +| AAMP_TUNE_AUTHORIZATION_FAILURE | 40 | 4001 | AAMP: Authorization failure | +| AAMP_TUNE_UNTRACKED_DRM_ERROR | 50 | 5001 | AAMP: DRM error untracked error | +| AAMP_TUNE_DRM_INIT_FAILED | 50 | 5002 | AAMP: DRM Initialization Failed | +| AAMP_TUNE_DRM_DATA_BIND_FAILED | 50 | 5003 | AAMP: InitData-DRM Binding Failed | +| AAMP_TUNE_DRM_SESSIONID_EMPTY | 50 | 5004 | AAMP: DRM Session ID Empty | +| AAMP_TUNE_DRM_CHALLENGE_FAILED | 50 | 5005 | AAMP: DRM License Challenge Generation Failed | +| AAMP_TUNE_LICENCE_TIMEOUT | 50 | 5006 | AAMP: DRM License Request Timed out | +| AAMP_TUNE_LICENCE_REQUEST_FAILED | 50 | 5007 | AAMP: DRM License Request Failed | +| AAMP_TUNE_INVALID_DRM_KEY | 50 | 5008 | AAMP: Invalid Key Error, from DRM | +| AAMP_TUNE_FAILED_TO_GET_KEYID | 50 | 5009 | AAMP: Failed to parse key id from PSSH | +| AAMP_TUNE_CORRUPT_DRM_DATA | 50 | 5010 | AAMP: DRM failure due to Corrupt DRM files | +| AAMP_TUNE_CORRUPT_DRM_METADATA | 50 | 5011 | AAMP: DRM failure due to Bad DRMMetadata in stream | +| AAMP_TUNE_DRM_DECRYPT_FAILED | 50 | 5012 | AAMP: DRM Decryption Failed for Fragments | +| AAMP_TUNE_DRM_UNSUPPORTED | 50 | 5013 | AAMP: DRM format Unsupported | +| AAMP_TUNE_DRM_SELF_ABORT | 50 | 5014 | AAMP: DRM license request aborted by player | +| AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN | 50 | 5015 | AAMP: Failed to get access token from Auth Service | +| AAMP_TUNE_DRM_KEY_UPDATE_FAILED | 50 | 5016 | AAMP: Failed to process DRM key | +| AAMP_TUNE_DEVICE_NOT_PROVISIONED | 51 | 5101 | AAMP: Device not provisioned | +| AAMP_TUNE_HDCP_COMPLIANCE_ERROR | 52 | 5201 | AAMP: HDCP Compliance Check Failure | + +| AAMP_TUNE_UNSUPPORTED_STREAM_TYPE | 60 | 6001 | AAMP: Unsupported Stream Type | +| AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE | 60 | 6002 | AAMP: No supported Audio Types in Manifest | +| AAMP_TUNE_GST_PIPELINE_ERROR | 80 | 8001 | AAMP: Error from gstreamer pipeline | +| AAMP_TUNE_FAILED_PTS_ERROR | 80 | 8002 | AAMP: Playback failed due to PTS error | + +| AAMP_TUNE_PLAYBACK_STALLED | 7600 | 1 | AAMP: Playback was stalled due to lack of new fragments | +| AAMP_TUNE_FAILURE_UNKNOWN | 100 | 1 | AAMP: Unknown Failure | --- diff --git a/AampEvent.cpp b/AampEvent.cpp index 85a27e4bd..311467429 100644 --- a/AampEvent.cpp +++ b/AampEvent.cpp @@ -49,8 +49,8 @@ AAMPEventType AAMPEventObject::getType() const /** * @brief MediaErrorEvent Constructor */ -MediaErrorEvent::MediaErrorEvent(AAMPTuneFailure failure, int code, const std::string &desc, bool shouldRetry, int classCode, int reason, int businessStatus, const std::string &responseData, std::string sid): - AAMPEventObject(AAMP_EVENT_TUNE_FAILED, std::move(sid)), mFailure(failure), mCode(code), +MediaErrorEvent::MediaErrorEvent(AAMPTuneFailure failure, int code, int minorCode, const std::string &desc, bool shouldRetry, int classCode, int reason, int businessStatus, const std::string &responseData, std::string sid): + AAMPEventObject(AAMP_EVENT_TUNE_FAILED, std::move(sid)), mFailure(failure), mMajorCode(code), mMinorCode(minorCode), mDescription(desc), mShouldRetry(shouldRetry), mSecManagerClass(classCode), mSecManagerReasonCode(reason), mBusinessStatus(businessStatus), mResponseData(responseData) { @@ -67,15 +67,23 @@ AAMPTuneFailure MediaErrorEvent::getFailure() const } /** - * @brief Get Error Code + * @brief Get Major Code * - * @return Tune error code + * @return Major code */ -int MediaErrorEvent::getCode() const +int MediaErrorEvent::getMajorCode() const { - return mCode; + return mMajorCode; +} +/** + * @brief Get Minor Code + * + * @return Minor code + */ +int MediaErrorEvent::getMinorCode() const +{ + return mMinorCode; } - /** * @brief Get Description * diff --git a/AampEvent.h b/AampEvent.h index c1c0974e3..4d9d64bb3 100644 --- a/AampEvent.h +++ b/AampEvent.h @@ -123,40 +123,63 @@ typedef enum AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR, /**< Tune failure due to video playlist download error*/ AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR, /**< Tune failure due to audio playlist download error*/ AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR, /**< Tune failure due to A/V track sync error*/ - AAMP_TUNE_MANIFEST_REQ_FAILED, /**< Tune failure caused by manifest fetch failure*/ - AAMP_TUNE_AUTHORIZATION_FAILURE, /**< Not authorized to view the content*/ - AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE, /**< When fragment download fails for 5 consecutive fragments*/ - AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE, /**< Unable to download init fragment*/ - AAMP_TUNE_UNTRACKED_DRM_ERROR, /**< DRM error*/ - AAMP_TUNE_DRM_INIT_FAILED, /**< DRM initialization failure */ - AAMP_TUNE_DRM_DATA_BIND_FAILED, /**< InitData binding with DRM failed */ - AAMP_TUNE_DRM_SESSIONID_EMPTY, /**< DRM session ID empty */ - AAMP_TUNE_DRM_CHALLENGE_FAILED, /**< DRM key request challenge generation failed */ - AAMP_TUNE_LICENCE_TIMEOUT, /**< DRM license request timeout */ - AAMP_TUNE_LICENCE_REQUEST_FAILED, /**< DRM license got invalid response */ - AAMP_TUNE_INVALID_DRM_KEY, /**< DRM reporting invalid license key */ - AAMP_TUNE_UNSUPPORTED_STREAM_TYPE, /**< Unsupported stream type */ - AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE, /**< Unsupported audio type in manifest */ - AAMP_TUNE_FAILED_TO_GET_KEYID, /**< Failed to parse key id from init data*/ - AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN, /**< Failed to get session token from AuthService*/ - AAMP_TUNE_CORRUPT_DRM_DATA, /**< DRM failure due to corrupt drm data, self heal might clear further errors*/ - AAMP_TUNE_CORRUPT_DRM_METADATA, /**< DRM failure due to corrupt drm metadata in the stream*/ - AAMP_TUNE_DRM_DECRYPT_FAILED, /**< DRM Decryption Failed for Fragments */ - AAMP_TUNE_DRM_UNSUPPORTED, /**< DRM Format Unsupported */ - AAMP_TUNE_DRM_SELF_ABORT, /**< Download activity is aborted by player */ - AAMP_TUNE_GST_PIPELINE_ERROR, /**< Playback failure due to error from GStreamer pipeline or associated plugins */ - AAMP_TUNE_PLAYBACK_STALLED, /**< Playback was stalled due to valid fragments not available in playlist */ - AAMP_TUNE_CONTENT_NOT_FOUND, /**< The resource was not found at the URL provided (HTTP 404) */ - AAMP_TUNE_DRM_KEY_UPDATE_FAILED, /**< Failed to process DRM key, see the error code returned from Update() for more info */ - AAMP_TUNE_DEVICE_NOT_PROVISIONED, /**< STB not provisioned/corrupted; need to re-provision. */ - AAMP_TUNE_HDCP_COMPLIANCE_ERROR, /**< HDCP Compliance Check failure.Not compatible hdcp version for playback */ - AAMP_TUNE_INVALID_MANIFEST_FAILURE, /**< Manifest is invalid */ - AAMP_TUNE_FAILED_PTS_ERROR, /**< Playback failed due to PTS error */ - AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING, /**< Init fragments missing in playlist */ - AAMP_TUNE_DNS_RESOLVE_TIMEOUT, - AAMP_TUNE_CURL_CONNECTION_TIMEOUT, - AAMP_TUNE_DATA_TRANSFER_TIMEOUT, - AAMP_TUNE_FAILURE_UNKNOWN /**< Unknown failure */ + + + //Resource failure + AAMP_TUNE_CONTENT_NOT_FOUND, /**< The resource was not found at the URL provided (HTTP 404) */ + + //Download failure + AAMP_TUNE_MANIFEST_REQ_FAILED, /**< Tune failure caused by manifest fetch failure*/ + AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE, /**< When fragment download fails for 5 consecutive fragments*/ + AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE, /**< Unable to download init fragment*/ + AAMP_TUNE_INVALID_MANIFEST_FAILURE, /**< Manifest is invalid */ + AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING, /**< Init fragments missing in playlist */ + AAMP_TUNE_DNS_RESOLVE_TIMEOUT, /**< DNS resolve timedout */ + AAMP_TUNE_CURL_CONNECTION_TIMEOUT, /**< Curl connection timedout */ + AAMP_TUNE_DATA_TRANSFER_TIMEOUT, /**< Data transfer timedout */ + + //Authorization failure + AAMP_TUNE_AUTHORIZATION_FAILURE, /**< Not authorized to view the content*/ + + //DRM Failure + AAMP_TUNE_UNTRACKED_DRM_ERROR, /**< DRM error*/ + AAMP_TUNE_DRM_INIT_FAILED, /**< DRM initialization failure */ + AAMP_TUNE_DRM_DATA_BIND_FAILED, /**< InitData binding with DRM failed */ + AAMP_TUNE_DRM_SESSIONID_EMPTY, /**< DRM session ID empty */ + AAMP_TUNE_DRM_CHALLENGE_FAILED, /**< DRM key request challenge generation failed */ + AAMP_TUNE_LICENCE_TIMEOUT, /**< DRM license request timeout */ + AAMP_TUNE_LICENCE_REQUEST_FAILED, /**< DRM license got invalid response */ + AAMP_TUNE_INVALID_DRM_KEY, /**< DRM reporting invalid license key */ + AAMP_TUNE_FAILED_TO_GET_KEYID, /**< Failed to parse key id from init data*/ + AAMP_TUNE_CORRUPT_DRM_DATA, /**< DRM failure due to corrupt drm data, self heal might clear further errors*/ + AAMP_TUNE_CORRUPT_DRM_METADATA, /**< DRM failure due to corrupt drm metadata in the stream*/ + AAMP_TUNE_DRM_DECRYPT_FAILED, /**< DRM Decryption Failed for Fragments */ + AAMP_TUNE_DRM_UNSUPPORTED, /**< DRM Format Unsupported */ + AAMP_TUNE_DRM_SELF_ABORT, /**< Download activity is aborted by player */ + AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN, /**< Failed to get session token from AuthService*/ + AAMP_TUNE_DRM_KEY_UPDATE_FAILED, /**< Failed to process DRM key, see the error code returned from Update() for more info */ + + + + //Provisioning failure + AAMP_TUNE_DEVICE_NOT_PROVISIONED, /**< STB not provisioned/corrupted; need to re-provision. */ + + //Hdcp failure + AAMP_TUNE_HDCP_COMPLIANCE_ERROR, /**< HDCP Compliance Check failure.Not compatible hdcp version for playback */ + + //Stream failure + AAMP_TUNE_UNSUPPORTED_STREAM_TYPE, /**< Unsupported stream type */ + AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE, /**< Unsupported audio type in manifest */ + + //Gstreamer error + AAMP_TUNE_GST_PIPELINE_ERROR, /**< Playback failed due to an error in the GStreamer pipeline */ + AAMP_TUNE_FAILED_PTS_ERROR, /**< Playback failed due to PTS error */ + + //Playback failure + AAMP_TUNE_PLAYBACK_STALLED, /**< Playback was stalled due to valid fragments not available in playlist */ + + //Unknown failure + AAMP_TUNE_FAILURE_UNKNOWN } AAMPTuneFailure; /** @@ -383,7 +406,8 @@ struct AAMPEvent struct { AAMPTuneFailure failure; /**< Error Type */ - int code; /**< Error code */ + int code; + int minorCode; /**< Error code */ const char *description; /**< Error description */ bool shouldRetry; /**< If recovery on retry is possible */ int32_t classCode; /**< class Code */ @@ -619,7 +643,8 @@ class AAMPEventObject class MediaErrorEvent: public AAMPEventObject { AAMPTuneFailure mFailure; /**< Error Type */ - int mCode; /**< Error code */ + int mMajorCode; /**< Error code */ + int mMinorCode; std::string mDescription; /**< Error description */ std::string mResponseData; /**< Response Data */ bool mShouldRetry; /**< If recovery on retry is possible */ @@ -638,10 +663,11 @@ class MediaErrorEvent: public AAMPEventObject * * @param[in] failure - Failure type * @param[in] code - Error code + * @param[in] minorCode - Error code * @param[in] desc - Error description * @param[in] shouldRetry - Retry or not */ - MediaErrorEvent(AAMPTuneFailure failure, int code, const std::string &desc, bool shouldRetry, int32_t classCode, int32_t reason, int32_t businessStatus, const std::string &responseData, std::string sid); + MediaErrorEvent(AAMPTuneFailure failure, int code, int minorCode, const std::string &desc, bool shouldRetry, int32_t classCode, int32_t reason, int32_t businessStatus, const std::string &responseData, std::string sid); /** * @brief MediaErrorEvent Destructor @@ -653,11 +679,14 @@ class MediaErrorEvent: public AAMPEventObject */ AAMPTuneFailure getFailure() const; + /** + * @fn getMinorCode + */ + int getMinorCode() const; /** * @fn getCode */ - int getCode() const; - + int getMajorCode() const; /** * @fn getDescription */ diff --git a/AampEventListener.cpp b/AampEventListener.cpp index a9ce6fd2b..53f67d79e 100644 --- a/AampEventListener.cpp +++ b/AampEventListener.cpp @@ -41,7 +41,8 @@ static void GenerateLegacyAAMPEvent(const AAMPEventPtr &e, AAMPEvent &event) { MediaErrorEventPtr ev = std::dynamic_pointer_cast(e); event.data.mediaError.failure = ev->getFailure(); - event.data.mediaError.code = ev->getCode(); + event.data.mediaError.code = ev->getMajorCode(); + event.data.mediaError.minorCode = ev->getMinorCode(); event.data.mediaError.description = ev->getDescription().c_str(); event.data.mediaError.shouldRetry = ev->shouldRetry(); if(-1 != ev->getClass()) //Only send the verbose logging for DRM failure due to secclient/secmanager diff --git a/jsbindings/jsbindings.cpp b/jsbindings/jsbindings.cpp index 1d2747582..9f0c6c071 100644 --- a/jsbindings/jsbindings.cpp +++ b/jsbindings/jsbindings.cpp @@ -928,14 +928,18 @@ class AAMP_JSListener_TuneFailed : public AAMP_JSListener void setEventProperties(const AAMPEventPtr& e, JSContextRef context, JSObjectRef eventObj) { MediaErrorEventPtr evt = std::dynamic_pointer_cast(e); - - int code = evt->getCode(); + int code = evt->getMajorCode(); + int minorCode = evt->getMinorCode(); const char* description = evt->getDescription().c_str(); JSStringRef name = JSStringCreateWithUTF8CString("code"); JSObjectSetProperty(context, eventObj, name, JSValueMakeNumber(context, code), kJSPropertyAttributeReadOnly, NULL); JSStringRelease(name); + name = JSStringCreateWithUTF8CString("minorCode"); + JSObjectSetProperty(context, eventObj, name, JSValueMakeNumber(context, minorCode), kJSPropertyAttributeReadOnly, NULL); + JSStringRelease(name); + name = JSStringCreateWithUTF8CString("description"); JSObjectSetProperty(context, eventObj, name, aamp_CStringToJSValue(context, description), kJSPropertyAttributeReadOnly, NULL); JSStringRelease(name); diff --git a/jsbindings/jseventlistener.cpp b/jsbindings/jseventlistener.cpp index a042ecc19..bbac3ffd5 100644 --- a/jsbindings/jseventlistener.cpp +++ b/jsbindings/jseventlistener.cpp @@ -258,7 +258,11 @@ class AAMP_Listener_PlaybackFailed : public AAMP_JSEventListener JSStringRef prop; prop = JSStringCreateWithUTF8CString("code"); - JSObjectSetProperty(p_obj->_ctx, jsEventObj, prop, JSValueMakeNumber(p_obj->_ctx, evt->getCode()), kJSPropertyAttributeReadOnly, NULL); + JSObjectSetProperty(p_obj->_ctx, jsEventObj, prop, JSValueMakeNumber(p_obj->_ctx, evt->getMajorCode()), kJSPropertyAttributeReadOnly, NULL); + JSStringRelease(prop); + + prop = JSStringCreateWithUTF8CString("minorCode"); + JSObjectSetProperty(p_obj->_ctx, jsEventObj, prop, JSValueMakeNumber(p_obj->_ctx, evt->getMinorCode()), kJSPropertyAttributeReadOnly, NULL); JSStringRelease(prop); prop = JSStringCreateWithUTF8CString("description"); diff --git a/priv_aamp.cpp b/priv_aamp.cpp index b427d8995..9b445f770 100644 --- a/priv_aamp.cpp +++ b/priv_aamp.cpp @@ -170,53 +170,78 @@ struct CurlCbContextSyncTime struct TuneFailureMap { AAMPTuneFailure tuneFailure; /**< Failure ID */ - int code; /**< Error code */ + int code; /**< Major Error code */ + int minorCode; /**< Minor Error code */ const char* description; /**< Textual description */ }; static TuneFailureMap tuneFailureMap[] = { - {AAMP_TUNE_INIT_FAILED, 10, "AAMP: init failed"}, //"Fragmentcollector initialization failed" - {AAMP_TUNE_INIT_FAILED_MANIFEST_DNLD_ERROR, 10, "AAMP: init failed (unable to download manifest)"}, - {AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR, 10, "AAMP: init failed (manifest missing tracks)"}, - {AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR, 10, "AAMP: init failed (corrupt/invalid manifest)"}, - {AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR, 10, "AAMP: init failed (unable to download video playlist)"}, - {AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR, 10, "AAMP: init failed (unable to download audio playlist)"}, - {AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR, 10, "AAMP: init failed (unsynchronized tracks)"}, - {AAMP_TUNE_MANIFEST_REQ_FAILED, 10, "AAMP: Manifest Download failed"}, //"Playlist refresh failed" - {AAMP_TUNE_AUTHORIZATION_FAILURE, 40, "AAMP: Authorization failure"}, - {AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE, 10, "AAMP: fragment download failures"}, - {AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE, 10, "AAMP: init fragment download failed"}, - {AAMP_TUNE_UNTRACKED_DRM_ERROR, 50, "AAMP: DRM error untracked error"}, - {AAMP_TUNE_DRM_INIT_FAILED, 50, "AAMP: DRM Initialization Failed"}, - {AAMP_TUNE_DRM_DATA_BIND_FAILED, 50, "AAMP: InitData-DRM Binding Failed"}, - {AAMP_TUNE_DRM_SESSIONID_EMPTY, 50, "AAMP: DRM Session ID Empty"}, - {AAMP_TUNE_DRM_CHALLENGE_FAILED, 50, "AAMP: DRM License Challenge Generation Failed"}, - {AAMP_TUNE_LICENCE_TIMEOUT, 50, "AAMP: DRM License Request Timed out"}, - {AAMP_TUNE_LICENCE_REQUEST_FAILED, 50, "AAMP: DRM License Request Failed"}, - {AAMP_TUNE_INVALID_DRM_KEY, 50, "AAMP: Invalid Key Error, from DRM"}, - {AAMP_TUNE_UNSUPPORTED_STREAM_TYPE, 60, "AAMP: Unsupported Stream Type"}, //"Unable to determine stream type for DRM Init" - {AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE, 60, "AAMP: No supported Audio Types in Manifest"}, - {AAMP_TUNE_FAILED_TO_GET_KEYID, 50, "AAMP: Failed to parse key id from PSSH"}, - {AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN, 50, "AAMP: Failed to get access token from Auth Service"}, - {AAMP_TUNE_CORRUPT_DRM_DATA, 51, "AAMP: DRM failure due to Corrupt DRM files"}, - {AAMP_TUNE_CORRUPT_DRM_METADATA, 50, "AAMP: DRM failure due to Bad DRMMetadata in stream"}, - {AAMP_TUNE_DRM_DECRYPT_FAILED, 50, "AAMP: DRM Decryption Failed for Fragments"}, - {AAMP_TUNE_DRM_UNSUPPORTED, 50, "AAMP: DRM format Unsupported"}, - {AAMP_TUNE_DRM_SELF_ABORT, 50, "AAMP: DRM license request aborted by player"}, - {AAMP_TUNE_GST_PIPELINE_ERROR, 80, "AAMP: Error from gstreamer pipeline"}, - {AAMP_TUNE_PLAYBACK_STALLED, 7600, "AAMP: Playback was stalled due to lack of new fragments"}, - {AAMP_TUNE_CONTENT_NOT_FOUND, 20, "AAMP: Resource was not found at the URL(HTTP 404)"}, - {AAMP_TUNE_DRM_KEY_UPDATE_FAILED, 50, "AAMP: Failed to process DRM key"}, - {AAMP_TUNE_DEVICE_NOT_PROVISIONED, 52, "AAMP: Device not provisioned"}, - {AAMP_TUNE_HDCP_COMPLIANCE_ERROR, 53, "AAMP: HDCP Compliance Check Failure"}, - {AAMP_TUNE_INVALID_MANIFEST_FAILURE, 10, "AAMP: Invalid Manifest, parse failed"}, - {AAMP_TUNE_FAILED_PTS_ERROR, 80, "AAMP: Playback failed due to PTS error"}, - {AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING, 10, "AAMP: init fragments missing in playlist"}, - {AAMP_TUNE_DNS_RESOLVE_TIMEOUT, 10, "AAMP: Manifest download failed due to DNS resolve timeout"}, - {AAMP_TUNE_CURL_CONNECTION_TIMEOUT, 10, "AAMP: Manifest download failed due to connection timeout"}, - {AAMP_TUNE_DATA_TRANSFER_TIMEOUT, 10, "AAMP: Manifest download failed due to data transfer timeout"}, - {AAMP_TUNE_FAILURE_UNKNOWN, 100, "AAMP: Unknown Failure"} + //Init failure + {AAMP_TUNE_INIT_FAILED, 10, 1001, "AAMP: init failed"}, //"Fragmentcollector initialization failed" + {AAMP_TUNE_INIT_FAILED_MANIFEST_DNLD_ERROR, 10, 1002, "AAMP: init failed (unable to download manifest)"}, + {AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR, 10, 1003, "AAMP: init failed (manifest missing tracks)"}, + {AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR, 10, 1004, "AAMP: init failed (corrupt/invalid manifest)"}, + {AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR, 10, 1005, "AAMP: init failed (unable to download video playlist)"}, + {AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR, 10, 1006, "AAMP: init failed (unable to download audio playlist)"}, + {AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR, 10, 1007, "AAMP: init failed (unsynchronized tracks)"}, + + + //Resource failure + {AAMP_TUNE_CONTENT_NOT_FOUND, 20, 2001, "AAMP: Resource was not found at the URL(HTTP 404)"}, + + //Download failure + {AAMP_TUNE_MANIFEST_REQ_FAILED, 30, 3001, "AAMP: Manifest Download failed"}, //"Playlist refresh failed" + {AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE, 30, 3002, "AAMP: fragment download failures"}, + {AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE, 30, 3003, "AAMP: init fragment download failed"}, + {AAMP_TUNE_INVALID_MANIFEST_FAILURE, 30, 3004, "AAMP: Invalid Manifest, parse failed"}, + {AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING, 30, 3005, "AAMP: init fragments missing in playlist"}, + {AAMP_TUNE_DNS_RESOLVE_TIMEOUT, 30, 3006, "AAMP: Manifest download failed due to DNS resolve timeout"}, + {AAMP_TUNE_CURL_CONNECTION_TIMEOUT, 30, 3007, "AAMP: Manifest download failed due to connection timeout"}, + {AAMP_TUNE_DATA_TRANSFER_TIMEOUT, 30, 3008, "AAMP: Manifest download failed due to data transfer timeout"}, + + + //Authorization failure + {AAMP_TUNE_AUTHORIZATION_FAILURE, 40, 4001, "AAMP: Authorization failure"}, + + //DRM Failure + {AAMP_TUNE_UNTRACKED_DRM_ERROR, 50, 5001, "AAMP: DRM error untracked error"}, + {AAMP_TUNE_DRM_INIT_FAILED, 50, 5002, "AAMP: DRM Initialization Failed"}, + {AAMP_TUNE_DRM_DATA_BIND_FAILED, 50, 5003, "AAMP: InitData-DRM Binding Failed"}, + {AAMP_TUNE_DRM_SESSIONID_EMPTY, 50, 5004, "AAMP: DRM Session ID Empty"}, + {AAMP_TUNE_DRM_CHALLENGE_FAILED, 50, 5005, "AAMP: DRM License Challenge Generation Failed"}, + {AAMP_TUNE_LICENCE_TIMEOUT, 50, 5006, "AAMP: DRM License Request Timed out"}, + {AAMP_TUNE_LICENCE_REQUEST_FAILED, 50, 5007, "AAMP: DRM License Request Failed"}, + {AAMP_TUNE_INVALID_DRM_KEY, 50, 5008, "AAMP: Invalid Key Error, from DRM"}, + {AAMP_TUNE_FAILED_TO_GET_KEYID, 50, 5009, "AAMP: Failed to parse key id from PSSH"}, + {AAMP_TUNE_CORRUPT_DRM_DATA, 50, 5010, "AAMP: DRM failure due to Corrupt DRM files"}, + {AAMP_TUNE_CORRUPT_DRM_METADATA, 50, 5011, "AAMP: DRM failure due to Bad DRMMetadata in stream"}, + {AAMP_TUNE_DRM_DECRYPT_FAILED, 50, 5012, "AAMP: DRM Decryption Failed for Fragments"}, + {AAMP_TUNE_DRM_UNSUPPORTED, 50, 5013, "AAMP: DRM format Unsupported"}, + {AAMP_TUNE_DRM_SELF_ABORT, 50, 5014, "AAMP: DRM license request aborted by player"}, + {AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN, 50, 5015, "AAMP: Failed to get access token from Auth Service"}, + {AAMP_TUNE_DRM_KEY_UPDATE_FAILED, 50, 5016, "AAMP: Failed to process DRM key"}, + + + //Provisioning failure + {AAMP_TUNE_DEVICE_NOT_PROVISIONED, 51, 5101, "AAMP: Device not provisioned"}, + + //Hdcp failure + {AAMP_TUNE_HDCP_COMPLIANCE_ERROR, 52, 5201, "AAMP: HDCP Compliance Check Failure"}, + + //Stream failure + {AAMP_TUNE_UNSUPPORTED_STREAM_TYPE, 60, 6001, "AAMP: Unsupported Stream Type"}, //"Unable to determine stream type for DRM Init" + {AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE, 60, 6002, "AAMP: No supported Audio Types in Manifest"}, + + //Gstreamer error + {AAMP_TUNE_GST_PIPELINE_ERROR, 80, 8001, "AAMP: Error from gstreamer pipeline"}, + {AAMP_TUNE_FAILED_PTS_ERROR, 80, 8002, "AAMP: Playback failed due to PTS error"}, + + //Playback failure + {AAMP_TUNE_PLAYBACK_STALLED, 7600, 1, "AAMP: Playback was stalled due to lack of new fragments"}, + + //Unknown failure + {AAMP_TUNE_FAILURE_UNKNOWN, 100, 1, "AAMP: Unknown Failure"} }; static const std::pair gCDAIErrorDetails[] = { @@ -2794,7 +2819,7 @@ void PrivateInstanceAAMP::SendErrorEvent(AAMPTuneFailure tuneFailure, const char lock.unlock(); if (sendErrorEvent) { - int code; + int code = 0, minorCode = 0; const char *errorDescription = NULL; DisableDownloads(); if(tuneFailure >= 0 && tuneFailure < AAMP_TUNE_FAILURE_UNKNOWN) @@ -2802,10 +2827,12 @@ void PrivateInstanceAAMP::SendErrorEvent(AAMPTuneFailure tuneFailure, const char if (tuneFailure == AAMP_TUNE_PLAYBACK_STALLED) { // allow config override for stall detection error code code = GETCONFIGVALUE_PRIV(eAAMPConfig_StallErrorCode); + minorCode = 0; } else { code = tuneFailureMap[tuneFailure].code; + minorCode = tuneFailureMap[tuneFailure].minorCode; } if(description) { @@ -2819,17 +2846,18 @@ void PrivateInstanceAAMP::SendErrorEvent(AAMPTuneFailure tuneFailure, const char else { code = tuneFailureMap[AAMP_TUNE_FAILURE_UNKNOWN].code; + minorCode = tuneFailureMap[AAMP_TUNE_FAILURE_UNKNOWN].minorCode; errorDescription = tuneFailureMap[AAMP_TUNE_FAILURE_UNKNOWN].description; } - MediaErrorEventPtr e = std::make_shared(tuneFailure, code, errorDescription, isRetryEnabled, secManagerClassCode, secManagerReasonCode, secClientBusinessStatus, responseData, GetSessionId()); + MediaErrorEventPtr e = std::make_shared(tuneFailure, code, minorCode, errorDescription, isRetryEnabled, secManagerClassCode, secManagerReasonCode, secClientBusinessStatus, responseData, GetSessionId()); SendAnomalyEvent(ANOMALY_ERROR, "Error[%d]:%s", tuneFailure, e->getDescription().c_str()); if (!mAppName.empty()) { - AAMPLOG_ERR("%s PLAYER[%d] APP: %s Sending error %s",(mbPlayEnabled?STRFGPLAYER:STRBGPLAYER), mPlayerId, mAppName.c_str(), e->getDescription().c_str()); + AAMPLOG_ERR("%s PLAYER[%d] APP: %s Sending error %s code [%d:%d]",(mbPlayEnabled?STRFGPLAYER:STRBGPLAYER), mPlayerId, mAppName.c_str(), e->getDescription().c_str(),code, minorCode); } else { - AAMPLOG_ERR("%s PLAYER[%d] Sending error %s",(mbPlayEnabled?STRFGPLAYER:STRBGPLAYER), mPlayerId, e->getDescription().c_str()); + AAMPLOG_ERR("%s PLAYER[%d] Sending error %s code [%d:%d]",(mbPlayEnabled?STRFGPLAYER:STRBGPLAYER), mPlayerId, e->getDescription().c_str(),code, minorCode); } if (rate != AAMP_NORMAL_PLAY_RATE) diff --git a/test/aampcli/Aampcli.cpp b/test/aampcli/Aampcli.cpp index 785676ea8..bad476dbe 100644 --- a/test/aampcli/Aampcli.cpp +++ b/test/aampcli/Aampcli.cpp @@ -503,7 +503,7 @@ void MyAAMPEventListener::Event(const AAMPEventPtr& e) { MediaErrorEventPtr ev = std::dynamic_pointer_cast(e); mAampcli.mTuneFailureDescription = ev->getDescription(); - AAMPCLI_PRINTF("[AAMPCLI] AAMP_EVENT_TUNE_FAILED reason=%s\n",mAampcli.mTuneFailureDescription.c_str()); + AAMPCLI_PRINTF("[AAMPCLI] AAMP_EVENT_TUNE_FAILED reason=%s code [%d:%d]\n",mAampcli.mTuneFailureDescription.c_str(),ev->getMajorCode(), ev->getMinorCode()); break; } case AAMP_EVENT_SPEED_CHANGED: diff --git a/test/utests/fakes/FakeAampEvent.cpp b/test/utests/fakes/FakeAampEvent.cpp index c30c0cda5..8e5c95606 100644 --- a/test/utests/fakes/FakeAampEvent.cpp +++ b/test/utests/fakes/FakeAampEvent.cpp @@ -328,14 +328,15 @@ int SupportedSpeedsChangedEvent::getSupportedSpeedCount() const return 0; } -MediaErrorEvent::MediaErrorEvent(AAMPTuneFailure failure, int code, const std::string &desc, bool shouldRetry, int classCode, int reason, int businessStatus, const std::string &responseData, std::string sid): +MediaErrorEvent::MediaErrorEvent(AAMPTuneFailure failure, int code, int minorCode, const std::string &desc, bool shouldRetry, int classCode, int reason, int businessStatus, const std::string &responseData, std::string sid): AAMPEventObject(AAMP_EVENT_TUNE_FAILED, std::move(sid)) { } bool MediaErrorEvent::shouldRetry(void) const { return false; } int32_t MediaErrorEvent::getBusinessStatus(void) const { return 0; } int32_t MediaErrorEvent::getClass(void) const { return 0; } -int MediaErrorEvent::getCode(void) const { return 0; } +int MediaErrorEvent::getMajorCode(void) const { return 0; } +int MediaErrorEvent::getMinorCode(void) const { return 0; } BitrateChangeEvent::BitrateChangeEvent(int time, BitsPerSecond bitrate, const std::string &desc, int width, int height, double frameRate, double position, bool cappedProfile, int displayWidth, int displayHeight, VideoScanType videoScanType, int aspectRatioWidth, int aspectRatioHeight, std::string sid): AAMPEventObject(AAMP_EVENT_BITRATE_CHANGED, std::move(sid)) diff --git a/test/utests/tests/AampEventTests/AampEventTests.cpp b/test/utests/tests/AampEventTests/AampEventTests.cpp index e8a6ebfe3..f6a9c8332 100644 --- a/test/utests/tests/AampEventTests/AampEventTests.cpp +++ b/test/utests/tests/AampEventTests/AampEventTests.cpp @@ -24,6 +24,8 @@ using namespace testing; #define EFFECTIVE_URL "http://manifest.mpd" +#define TUNE_FAILURE_UNKNOWN_MAJOR 100 +#define TUNE_FAILURE_UNKNOWN_MINOR 1 class AAMPEventTests : public ::testing::Test { protected: @@ -82,7 +84,7 @@ class MediaErrorEventTest : public testing::Test{ protected: void SetUp() override { - errorEvent = new MediaErrorEvent(AAMP_TUNE_FAILURE_UNKNOWN,1,"Test",false,0,0,0,"", session_id); + errorEvent = new MediaErrorEvent(AAMP_TUNE_FAILURE_UNKNOWN,TUNE_FAILURE_UNKNOWN_MAJOR,TUNE_FAILURE_UNKNOWN_MINOR,"Test",false,0,0,0,"", session_id); } void TearDown() override { delete errorEvent; @@ -93,7 +95,8 @@ class MediaErrorEventTest : public testing::Test{ TEST_F(MediaErrorEventTest, MediaErrorEventMethodsTest) { MediaErrorEvent errorEvent( AAMPTuneFailure::AAMP_TUNE_INIT_FAILED, - 0, + 10, + 1001, "Tune failure due to initialization error", true, 456, @@ -104,7 +107,8 @@ TEST_F(MediaErrorEventTest, MediaErrorEventMethodsTest) { ); EXPECT_EQ(errorEvent.getFailure(), AAMPTuneFailure::AAMP_TUNE_INIT_FAILED); - EXPECT_EQ(errorEvent.getCode(), 0); + EXPECT_EQ(errorEvent.getMajorCode(), 10); + EXPECT_EQ(errorEvent.getMinorCode(), 1001); EXPECT_EQ(errorEvent.getDescription(), "Tune failure due to initialization error"); EXPECT_EQ(errorEvent.getResponseData(), "response data"); EXPECT_TRUE(errorEvent.shouldRetry()); @@ -117,7 +121,8 @@ TEST_F(MediaErrorEventTest, MediaErrorEventMethodsTest) { TEST_F(MediaErrorEventTest, MediaErrorEventMethodsanotherTest) { EXPECT_EQ(errorEvent->getFailure(), AAMPTuneFailure::AAMP_TUNE_FAILURE_UNKNOWN); - EXPECT_EQ(errorEvent->getCode(), 1); + EXPECT_EQ(errorEvent->getMajorCode(), 100); + EXPECT_EQ(errorEvent->getMinorCode(), 1); EXPECT_EQ(errorEvent->getDescription(), "Test"); EXPECT_EQ(errorEvent->getResponseData(), ""); EXPECT_FALSE(errorEvent->shouldRetry()); @@ -127,7 +132,74 @@ TEST_F(MediaErrorEventTest, MediaErrorEventMethodsanotherTest) { EXPECT_EQ(errorEvent->GetSessionId(), session_id); } +// Unified structure to hold test parameters for all MediaErrorEvent scenarios +struct MediaErrorEventParams { + AAMPTuneFailure failure; + int code; + int minorCode; + std::string description; + bool shouldRetry; + int classCode; + int reasonCode; + int businessStatus; + std::string responseData; +}; + +// Unified parameterized test fixture for MediaErrorEvent +class MediaErrorEventParameterizedTest : public testing::TestWithParam { +}; + +// L1 Test: MediaErrorEvent with all error scenarios (Failure Types, Tune failure, DRM failure, and Manifest failures) +TEST_P(MediaErrorEventParameterizedTest, MediaErrorEventAllScenariosTest) { + MediaErrorEventParams params = GetParam(); + + MediaErrorEvent event( + params.failure, + params.code, + params.minorCode, + params.description, + params.shouldRetry, + params.classCode, + params.reasonCode, + params.businessStatus, + params.responseData, + session_id + ); + + // Verify all fields + EXPECT_EQ(event.getFailure(), params.failure); + EXPECT_EQ(event.getMajorCode(), params.code); + EXPECT_EQ(event.getMinorCode(), params.minorCode); + EXPECT_EQ(event.getDescription(), params.description); + EXPECT_EQ(event.shouldRetry(), params.shouldRetry); + EXPECT_EQ(event.getClass(), params.classCode); + EXPECT_EQ(event.getReason(), params.reasonCode); + EXPECT_EQ(event.getBusinessStatus(), params.businessStatus); + EXPECT_EQ(event.getResponseData(), params.responseData); +} +// Instantiate the unified parameterized test with all error scenarios +INSTANTIATE_TEST_SUITE_P( + MediaErrorEventTest, + MediaErrorEventParameterizedTest, + testing::Values( + // General AAMPTuneFailure error scenarios + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_INIT_FAILED, 10, 1001, "Init failed error", false, 101, 201, 301, "Init failed response"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_MANIFEST_REQ_FAILED, 30, 3001, "Manifest request failed", true, 102, 202, 302, "Manifest failed response"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_AUTHORIZATION_FAILURE, 40, 4001, "Authorization failed", false, 103, 203, 303, "Auth failed response"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_UNTRACKED_DRM_ERROR, 50, 5001, "DRM error occurred", true, 104, 204, 304, "DRM error response"}, + + // DRM-specific error scenarios + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_FAILED_TO_GET_KEYID, 50, 5009, "DRM license acquisition failed", false, 200, 1, -1, "{\"errorCode\":\"3307\",\"message\":\"License request failed\"}"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_UNTRACKED_DRM_ERROR, 50, 5001, "DRM key system not supported", false, 300, 2, -1, "{\"errorCode\":\"3321\",\"message\":\"Unsupported key system\"}"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_DRM_INIT_FAILED, 50, 5002, "DRM session creation failed", false, 400, 3, -1, "{\"errorCode\":\"3304\",\"message\":\"Failed to create DRM session\"}"}, + + // Manifest parsing error scenarios + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR, 10, 1004, "Invalid manifest format", false, 0, 0, 0, "XML parse error at line 5"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR, 10, 1003, "Missing required manifest elements", false, 0, 0, 0, "Missing Period element in MPD"}, + MediaErrorEventParams{AAMPTuneFailure::AAMP_TUNE_INVALID_MANIFEST_FAILURE, 30, 3004, "Unsupported manifest version", false, 0, 0, 0, "MPD version 2.0 not supported"} + ) +); // Test fixture for SpeedChangedEvent class SpeedChangedEventTest : public testing::Test { protected: