1 /*
2 * Copyright (C) 2025 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 #include "avcodec_suspend.h"
17 #include "avcodec_errors.h"
18 #include "avcodec_log.h"
19 #include "i_avcodec_service.h"
20
21 namespace {
22 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "AVCodecSuspend"};
23 }
24
25 namespace OHOS {
26 namespace MediaAVCodec {
SuspendFreeze(const std::vector<pid_t> & pidList)27 int32_t AVCodecSuspend::SuspendFreeze(const std::vector<pid_t> &pidList)
28 {
29 CHECK_AND_RETURN_RET_LOG(!pidList.empty(), AVCS_ERR_INPUT_DATA_ERROR, "Freeze pidlist is empty");
30 return AVCodecServiceFactory::GetInstance().SuspendFreeze(pidList);
31 }
32
SuspendActive(const std::vector<pid_t> & pidList)33 int32_t AVCodecSuspend::SuspendActive(const std::vector<pid_t> &pidList)
34 {
35 CHECK_AND_RETURN_RET_LOG(!pidList.empty(), AVCS_ERR_INPUT_DATA_ERROR, "Active pidlist is empty");
36 return AVCodecServiceFactory::GetInstance().SuspendActive(pidList);
37 }
38
SuspendActiveAll()39 int32_t AVCodecSuspend::SuspendActiveAll()
40 {
41 return AVCodecServiceFactory::GetInstance().SuspendActiveAll();
42 }
43 } // namespace MediaAVCodec
44 } // namespace OHOS
45
46