1 /* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_CAMERA_DPS_VIDEO_REPORT_H 17 #define OHOS_CAMERA_DPS_VIDEO_REPORT_H 18 19 #include "dp_utils.h" 20 #include "deferred_video_job.h" 21 #include "singleton.h" 22 23 namespace OHOS { 24 namespace CameraStandard { 25 namespace DeferredProcessing { 26 const std::string EVENT_KEY_PNAMEID = "PNAMEID"; 27 const std::string EVENT_KEY_PVERSIONID = "PVERSIONID"; 28 const std::string EVENT_KEY_VIDEOID = "VIDEOID"; 29 const std::string EVENT_KEY_ABORTTYPE = "ABORTTYPE"; 30 const std::string EVENT_KEY_ABORTTIME = "ABORTTIME"; 31 const std::string EVENT_KEY_RECOVERTIME = "RECOVERTIME"; 32 const std::string EVENT_KEY_COMPLETETIME = "COMPLETETIME"; 33 const std::string EVENT_KEY_REALCOMPLETETIME = "REALCOMPLETETIME"; 34 35 struct VideoRecord { 36 std::string videoId; 37 std::string calleBundle; 38 std::string calleVersion; 39 uint64_t addTime = 0; 40 uint64_t processTime = 0; 41 uint64_t pauseStartTime = 0; 42 uint64_t pauseEndTime = 0; 43 uint64_t totlePauseTime = 0; ~VideoRecordVideoRecord44 ~VideoRecord() 45 {} 46 }; 47 48 class DfxVideoReport : public Singleton<DfxVideoReport> { 49 DECLARE_SINGLETON(DfxVideoReport) 50 51 public: 52 void ReportAddVideoEvent(const std::string& videoId, DpsCallerInfo callerInfo); 53 void ReportRemoveVideoEvent(const std::string& videoId, DpsCallerInfo callerInfo); 54 void ReportPauseVideoEvent(const std::string& videoId, int32_t pauseReason); 55 void ReportResumeVideoEvent(const std::string& videoId); 56 void ReportCompleteVideoEvent(const std::string &videoId); 57 58 private: 59 std::map<std::string, VideoRecord> processVideoInfo_; 60 }; 61 } // namespace DeferredProcessingService 62 } // namespace CameraStandard 63 } // namespace OHOS 64 #endif // OHOS_CAMERA_DPS_VIDEO_REPORT_H