@@ -248,16 +248,14 @@ bool DrmManager::ProcessLicense(DataForLicenseProcess &data) {
248248 static_cast <DrmLicenseHelper::DrmType>(drm_type_), nullptr , nullptr );
249249 if (DRM_SUCCESS != ret || nullptr == response_data || 0 == response_len) {
250250 LOG_ERROR (" [DrmManager] Fail to get respone by license server url." );
251- SendInstallKeyError ();
251+ SendInstallKeyError (" Fail to get respone by license server url. " );
252252 return false ;
253253 }
254254 LOG_INFO (" [DrmManager] Response length : %lu" , response_len);
255- if (!InstallKey (const_cast <void *>(reinterpret_cast <const void *>(
256- data.session_id .c_str ())),
257- static_cast <void *>(response_data),
258- reinterpret_cast <void *>(response_len))) {
259- SendInstallKeyError ();
260- }
255+ InstallKey (const_cast <void *>(
256+ reinterpret_cast <const void *>(data.session_id .c_str ())),
257+ static_cast <void *>(response_data),
258+ reinterpret_cast <void *>(response_len));
261259 free (response_data);
262260 } else if (request_license_channel_) {
263261 // Get license via the Dart callback.
@@ -268,7 +266,7 @@ bool DrmManager::ProcessLicense(DataForLicenseProcess &data) {
268266 return false ;
269267}
270268
271- bool DrmManager::InstallKey (void *session_id, void *response_data,
269+ void DrmManager::InstallKey (void *session_id, void *response_data,
272270 void *response_len) {
273271 LOG_INFO (" [DrmManager] Start install license." );
274272
@@ -281,21 +279,17 @@ bool DrmManager::InstallKey(void *session_id, void *response_data,
281279 if (ret != DM_ERROR_NONE) {
282280 LOG_ERROR (" [DrmManager] Fail to install eme key: %s" ,
283281 get_error_message (ret));
284- return false ;
282+ SendInstallKeyError ( get_error_message (ret)) ;
285283 }
286- return true ;
287284}
288285
289286void DrmManager::SetErrorCallback (ErrorCallback callback) {
290287 error_callback_ = callback;
291288}
292289
293- void DrmManager::SendInstallKeyError () {
290+ void DrmManager::SendInstallKeyError (const std::string &error_message ) {
294291 if (error_callback_) {
295292 std::string error_code = " [DrmManager] error" ;
296- std::string error_message =
297- " Error: install drm key failed, please check licenseURL or network "
298- " connection." ;
299293 error_callback_ (error_code, error_message);
300294 }
301295}
@@ -322,16 +316,14 @@ void DrmManager::RequestLicense(std::string &session_id, std::string &message) {
322316 response = std::get<std::vector<uint8_t >>(*success_value);
323317 } else {
324318 LOG_ERROR (" [DrmManager] Fail to get response." );
325- SendInstallKeyError ();
319+ SendInstallKeyError (" Fail to get response. " );
326320 return ;
327321 }
328322 LOG_INFO (" [DrmManager] Response length : %d" , response.size ());
329- if (!InstallKey (const_cast <void *>(reinterpret_cast <const void *>(
330- session_id.c_str ())),
331- reinterpret_cast <void *>(response.data ()),
332- reinterpret_cast <void *>(response.size ()))) {
333- SendInstallKeyError ();
334- }
323+ InstallKey (const_cast <void *>(
324+ reinterpret_cast <const void *>(session_id.c_str ())),
325+ reinterpret_cast <void *>(response.data ()),
326+ reinterpret_cast <void *>(response.size ()));
335327 },
336328 nullptr , nullptr );
337329 request_license_channel_->InvokeMethod (
0 commit comments