diff --git a/gallery/include/player_ability_slice.h b/gallery/include/player_ability_slice.h index ac25d86cbfb77a7499e720d7680295ea6788d3dd..132f4b227042b7c86d7879fc374a69f0b115f45e 100755 --- a/gallery/include/player_ability_slice.h +++ b/gallery/include/player_ability_slice.h @@ -120,6 +120,7 @@ protected: private: void Clear(); + void ListernersClear(); void ShowErrorTips(); void SetUpRootView(); void SetUpBackArea(const char* pathHeader); diff --git a/gallery/src/player_ability_slice.cpp b/gallery/src/player_ability_slice.cpp index 5a24454707443daf13ad0f8e5e9a09dd04ba60c2..876113186c18f0267fb9fd3664da9c2ce6feded7 100755 --- a/gallery/src/player_ability_slice.cpp +++ b/gallery/src/player_ability_slice.cpp @@ -51,14 +51,7 @@ std::shared_ptr PlayerAbilitySlice::CreatePlayer() void PlayerAbilitySlice::Clear() { printf("PlayerAbilitySlice::Clear | enter\n"); - if (backIconListener_ != nullptr) { - delete backIconListener_; - backIconListener_ = nullptr; - } - if (onClickListener_ != nullptr) { - delete onClickListener_; - onClickListener_ = nullptr; - } + ListernersClear(); if (surfaceView_ != nullptr) { delete surfaceView_; surfaceView_ = nullptr; @@ -106,6 +99,18 @@ void PlayerAbilitySlice::Clear() printf("PlayerAbilitySlice::Clear() | end\n"); } +void PlayerAbilitySlice::ListernersClear() +{ + if (backIconListener_ != nullptr) { + delete backIconListener_; + backIconListener_ = nullptr; + } + if (onClickListener_ != nullptr) { + delete onClickListener_; + onClickListener_ = nullptr; + } +} + void PlayerAbilitySlice::ShowErrorTips() { errorTips_ = new UILabel(); diff --git a/launcher/launcher/src/main/cpp/app_manage.cpp b/launcher/launcher/src/main/cpp/app_manage.cpp index d3cf1b7ab556355579f53e4e94a1d719bd0f4d7b..c598ecab690f8bea916dd287910e9a06d285839b 100755 --- a/launcher/launcher/src/main/cpp/app_manage.cpp +++ b/launcher/launcher/src/main/cpp/app_manage.cpp @@ -71,25 +71,30 @@ bool AppManage::GetAppInstallInfo(const char* bundleName) pApp->funcclick_ = installFuncclick_; pApp->funclPress_ = installFunclPress_; if (GetAailityInfosByBundleName(bundleName, pApp) == true) { - int i = 0; - for (; i < size_; i++) { - if (viewPage_[i]->FindApp(pApp)) { - break; - } - } - if (i == size_) { - for (i = 0; i < size_; i++) { - if (viewPage_[i]->AddApp(pApp)) { - return true; - } - } - } + HandleAppInstallInfo(pApp); } delete pApp; pApp = nullptr; return false; } +bool AppManage::HandleAppInstallInfo(AppInfo* pApp) +{ + int i = 0; + for (; i < size_; i++) { + if (viewPage_[i]->FindApp(pApp)) { + break; + } + } + if (i == size_) { + for (i = 0; i < size_; i++) { + if (viewPage_[i]->AddApp(pApp)) { + return true; + } + } + } +} + void AppManage::MyBundleStateCallback( const uint8_t installType, const uint8_t resultCode, const void* resultMessage, const char* bundleName, void* data) { diff --git a/launcher/launcher/src/main/cpp/app_manage.h b/launcher/launcher/src/main/cpp/app_manage.h index bd4da448d0c50eda736b01cc7b2192fc4c2cf713..3d7207b4e101bb800dcd098ba29a860bfc25c288 100755 --- a/launcher/launcher/src/main/cpp/app_manage.h +++ b/launcher/launcher/src/main/cpp/app_manage.h @@ -46,6 +46,7 @@ private: static void MyBundleOwnCallback(const uint8_t resultCode, const void* resultMessage); static bool GetAailityInfosByBundleName(const char* bundleName, AppInfo* pApp); static bool GetAppInstallInfo(const char* bundleName); + static bool HandleAppInstallInfo(AppInfo* pApp); private: BundleStatusCallback callBackParam_ { nullptr }; diff --git a/media/camera_sample.cpp b/media/camera_sample.cpp index 801644dd1e3572c3b34389a2d34010d85de9a41f..3db3456f98a90b4e69551ff22ff513bc5aa75e63 100755 --- a/media/camera_sample.cpp +++ b/media/camera_sample.cpp @@ -69,6 +69,13 @@ static void SampleSaveCapture(const char *p, uint32_t size) } } +Recorder *handleErrorLog(Recorder *recorder, int ret, string retStr) +{ + cout << retStr << ret << endl; + delete recorder; + return nullptr; +} + Recorder *SampleCreateRecorder() { int ret = 0; @@ -88,58 +95,42 @@ Recorder *SampleCreateRecorder() VideoCodecFormat encoder = HEVC; Recorder *recorder = new Recorder(); if ((ret = recorder->SetVideoSource(source, sourceId)) != SUCCESS) { - cout << "SetVideoSource failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetVideoSource failed."); } if ((ret = recorder->SetVideoEncoder(sourceId, encoder)) != SUCCESS) { - cout << "SetVideoEncoder failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetVideoEncoder failed."); } if ((ret = recorder->SetVideoSize(sourceId, width, height)) != SUCCESS) { - cout << "SetVideoSize failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetVideoSize failed."); } if ((ret = recorder->SetVideoFrameRate(sourceId, frameRate)) != SUCCESS) { - cout << "SetVideoFrameRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetVideoFrameRate failed."); } if ((ret = recorder->SetVideoEncodingBitRate(sourceId, rate)) != SUCCESS) { - cout << "SetVideoEncodingBitRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetVideoEncodingBitRate failed."); } if ((ret = recorder->SetCaptureRate(sourceId, fps)) != SUCCESS) { - cout << "SetCaptureRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetCaptureRate failed."); } if ((ret = recorder->SetAudioSource(inputSource, audioSourceId)) != SUCCESS) { - cout << "SetAudioSource failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetAudioSource failed."); } if ((ret = recorder->SetAudioEncoder(audioSourceId, audioFormat)) != SUCCESS) { - cout << "SetAudioEncoder failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetAudioEncoder failed."); } if ((ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate)) != SUCCESS) { - cout << "SetAudioSampleRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetAudioSampleRate failed."); } if ((ret = recorder->SetAudioChannels(audioSourceId, channelCount)) != SUCCESS) { - cout << "SetAudioChannels failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetAudioChannels failed."); } if ((ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate)) != SUCCESS) { - cout << "SetAudioEncodingBitRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetAudioEncodingBitRate failed."); } if ((ret = recorder->SetMaxDuration(36000)) != SUCCESS) { // 36000s=10h - cout << "SetAudioEncodingBitRate failed." << ret << endl; - goto ERROR; + return handleErrorLog(recorder, ret, "SetMaxDuration failed."); } return recorder; - -ERROR: - delete recorder; - return nullptr; } class SampleFrameStateCallback : public FrameStateCallback {