Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e9087a1c
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e9087a1c
编写于
9月 08, 2022
作者:
L
ling990
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ndk testcases Signed-off-by: ling990 <liling96@huawei.com>
Signed-off-by:
N
ling990
<
ling990@qq.com
>
上级
5c3e32cc
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
964 addition
and
0 deletion
+964
-0
multimedia/media/media_cpp_standard/BUILD.gn
multimedia/media/media_cpp_standard/BUILD.gn
+67
-0
multimedia/media/media_cpp_standard/Test.json
multimedia/media/media_cpp_standard/Test.json
+30
-0
multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp
...pp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp
+452
-0
multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp
...pp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp
+415
-0
未找到文件。
multimedia/media/media_cpp_standard/BUILD.gn
0 → 100644
浏览文件 @
e9087a1c
# Copyright (c) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
module_output_path = "acts/ActsAvcodecNdkTest"
ohos_moduletest_suite("ActsAvcodecNdkTest") {
module_out_path = module_output_path
sources = [
"audioDecEncNdk/src/ADecEncNdkSample.cpp",
"audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp",
"videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp",
"videoDecEncNdk/src/VDecEncNdkSample.cpp",
]
include_dirs = [
"include",
"audioDecEncNdk/include",
"videoDecEncNdk/include",
"//foundation/multimedia/audio_framework/interfaces/inner_api/native/audiocommon/include",
"//foundation/multimedia/player_framework/interfaces/kits/c",
"//utils/native/base/include",
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
]
cflags = [
"-Werror",
"-fno-rtti",
"-fno-exceptions",
"-Wall",
"-fno-common",
"-fstack-protector-strong",
"-Wshadow",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-fvisibility=hidden",
"-Wformat=2",
"-Wdate-time",
"",
]
deps = [
"//foundation/graphic/graphic_2d/frameworks/surface:surface",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_adec",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_aenc",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_codecbase",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_core",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_vdec",
"//foundation/multimedia/player_framework/interfaces/kits/c:native_media_venc",
"//utils/native/base:utils",
]
subsystem_name = "multimedia"
part_name = "multimedia_player_framework"
}
multimedia/media/media_cpp_standard/Test.json
0 → 100644
浏览文件 @
e9087a1c
{
"description"
:
"Config for avcodec ndk test cases"
,
"driver"
:
{
"module-name"
:
"ActsAvcodecNdkTest"
,
"native-test-timeout"
:
"30000"
,
"native-test-device-path"
:
"/data/local/tmp"
,
"runtime-hint"
:
"1s"
,
"type"
:
"CppTest"
},
"kits"
:
[
{
"type"
:
"PushKit"
,
"pre-push"
:
[
],
"push"
:
[
"ActsAvcodecNdkTest->/data/local/tmp/ActsAvcodecNdkTest"
,
"./resource/audio/audioDecode/AAC_48000_32_1.aac ->/data/media/"
,
"./resource/media/es/out_320_240_10s.h264 ->/data/media/"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"chmod 777 -R /data/media"
,
"chmod 777 /data/media/*"
]
}
]
}
\ No newline at end of file
multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp
0 → 100644
浏览文件 @
e9087a1c
此差异已折叠。
点击以展开。
multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp
0 → 100644
浏览文件 @
e9087a1c
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string>
#include "gtest/gtest.h"
#include "native_avcodec_videodecoder.h"
#include "native_avcodec_videoencoder.h"
#include "native_avcodec_base.h"
#include "native_avformat.h"
#include "ActsVideoDecEncNdkTest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
using
namespace
OHOS
;
using
namespace
OHOS
::
Media
;
namespace
{
const
string
MIME_TYPE_AVC
=
"video/avc"
;
const
string
MIME_TYPE_MPEG4
=
"video/mp4v-es"
;
constexpr
uint32_t
DEFAULT_WIDTH
=
320
;
constexpr
uint32_t
DEFAULT_HEIGHT
=
240
;
constexpr
uint32_t
DEFAULT_PIXELFORMAT
=
2
;
constexpr
uint32_t
DEFAULT_FRAMERATE
=
60
;
const
char
*
READPATH
=
"/data/media/out_320_240_10s.h264"
;
bool
CheckDecDesc
(
map
<
string
,
int
>
InDesc
,
OH_AVFormat
*
OutDesc
)
{
int32_t
out
;
for
(
const
auto
&
t
:
InDesc
)
{
bool
res
=
OH_AVFormat_GetIntValue
(
OutDesc
,
t
.
first
.
c_str
(),
&
out
);
cout
<<
"key: "
<<
t
.
first
<<
"; out: "
<<
out
<<
endl
;
if
(
!
res
)
{
cout
<<
"OH_AVFormat_GetIntValue Fail. key:"
<<
t
.
first
<<
endl
;
return
false
;
}
if
(
out
!=
t
.
second
)
{
cout
<<
"OH_AVFormat_GetIntValue error. key: "
<<
t
.
first
<<
"; expect: "
<<
t
.
second
<<
", actual: "
<<
out
<<
endl
;
return
false
;
}
out
=
0
;
}
return
true
;
}
bool
SetFormat
(
struct
OH_AVFormat
*
format
,
map
<
string
,
int
>
mediaDescription
)
{
const
char
*
key
;
for
(
const
auto
&
t
:
mediaDescription
)
{
key
=
t
.
first
.
c_str
();
if
(
not
OH_AVFormat_SetIntValue
(
format
,
key
,
t
.
second
))
{
cout
<<
"OH_AV_FormatPutIntValue Fail. format key: "
<<
t
.
first
<<
", value: "
<<
t
.
second
<<
endl
;
return
false
;
}
}
return
true
;
}
struct
OH_AVFormat
*
createFormat
()
{
OH_AVFormat
*
DefaultFormat
=
OH_AVFormat_Create
();
OH_AVFormat_SetIntValue
(
DefaultFormat
,
OH_MD_KEY_WIDTH
,
DEFAULT_WIDTH
);
OH_AVFormat_SetIntValue
(
DefaultFormat
,
OH_MD_KEY_HEIGHT
,
DEFAULT_HEIGHT
);
OH_AVFormat_SetIntValue
(
DefaultFormat
,
OH_MD_KEY_PIXEL_FORMAT
,
DEFAULT_PIXELFORMAT
);
OH_AVFormat_SetIntValue
(
DefaultFormat
,
OH_MD_KEY_FRAME_RATE
,
DEFAULT_FRAMERATE
);
return
DefaultFormat
;
}
}
/**
* @tc.number : ActsVideoDecEncNdkTest001
* @tc.name : stop at end of stream
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest001
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_MPEG4
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_001.es"
);
OH_AVFormat
*
VideoFormat
=
OH_AVFormat_Create
();
ASSERT_NE
(
nullptr
,
VideoFormat
);
map
<
string
,
int
>
VideoParam
=
{
{
OH_MD_KEY_WIDTH
,
DEFAULT_WIDTH
},
{
OH_MD_KEY_HEIGHT
,
DEFAULT_HEIGHT
},
{
OH_MD_KEY_PIXEL_FORMAT
,
DEFAULT_PIXELFORMAT
},
{
OH_MD_KEY_FRAME_RATE
,
DEFAULT_FRAMERATE
},
};
ASSERT_EQ
(
true
,
SetFormat
(
VideoFormat
,
VideoParam
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
OH_AVFormat
*
OutDescDec
=
OH_VideoDecoder_GetOutputDescription
(
videoDec
);
ASSERT_NE
(
nullptr
,
OutDescDec
);
ASSERT_EQ
(
true
,
CheckDecDesc
(
VideoParam
,
OutDescDec
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
OH_AVFormat
*
OutDescEnc
=
OH_VideoEncoder_GetOutputDescription
(
videoEnc
);
ASSERT_NE
(
nullptr
,
OutDescEnc
);
ASSERT_EQ
(
true
,
CheckDecDesc
(
VideoParam
,
OutDescEnc
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest002
* @tc.name : reset at end of stream
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest002
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_002.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ResetDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ResetEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest003
* @tc.name : release at end of stream
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest003
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_003.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest004
* @tc.name : flush at running
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest004
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetEosState
(
false
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_004.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
vDecEncSample
->
GetFrameCount
()
<
100
)
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
FlushDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
FlushEnc
());
vDecEncSample
->
ReRead
();
vDecEncSample
->
ResetDecParam
();
vDecEncSample
->
ResetEncParam
();
vDecEncSample
->
SetEosState
(
true
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_004_2.es"
);
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest005
* @tc.name : flush dec at eos and restart
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest005
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetEosState
(
false
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_005.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetDecEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
FlushDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
FlushEnc
());
vDecEncSample
->
ReRead
();
vDecEncSample
->
ResetDecParam
();
vDecEncSample
->
ResetEncParam
();
vDecEncSample
->
SetSavePath
(
"/data/media/video_005_2.es"
);
vDecEncSample
->
SetEosState
(
true
);
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest006
* @tc.name : stop at running and restart to eos
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest006
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetEosState
(
false
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_006.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
vDecEncSample
->
GetFrameCount
()
<
100
)
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopEnc
());
vDecEncSample
->
ReRead
();
vDecEncSample
->
ResetDecParam
();
vDecEncSample
->
ResetEncParam
();
vDecEncSample
->
SetEosState
(
true
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_006_2.es"
);
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
/**
* @tc.number : ActsVideoDecEncNdkTest007
* @tc.name : stop dec at eos and restart to eos
* @tc.desc : Basic function test
*/
HWTEST_F
(
ActsVideoDecEncNdkTest
,
ActsVideoDecEncNdkTest007
,
Function
|
MediumTest
|
Level1
)
{
VDecEncNdkSample
*
vDecEncSample
=
new
VDecEncNdkSample
();
struct
OH_AVCodec
*
videoDec
=
vDecEncSample
->
CreateVideoDecoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoDec
);
struct
OH_AVCodec
*
videoEnc
=
vDecEncSample
->
CreateVideoEncoderByMime
(
MIME_TYPE_AVC
);
ASSERT_NE
(
nullptr
,
videoEnc
);
vDecEncSample
->
SetReadPath
(
READPATH
);
vDecEncSample
->
SetEosState
(
false
);
vDecEncSample
->
SetSavePath
(
"/data/media/video_007.es"
);
OH_AVFormat
*
VideoFormat
=
createFormat
();
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureDec
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ConfigureEnc
(
VideoFormat
));
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
GetSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
SetOutputSurface
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
PrepareDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetDecEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
FlushEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
vDecEncSample
->
ReRead
();
vDecEncSample
->
ResetDecParam
();
vDecEncSample
->
ResetEncParam
();
vDecEncSample
->
SetSavePath
(
"/data/media/video_007_2.es"
);
vDecEncSample
->
SetEosState
(
true
);
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StartDec
());
while
(
!
vDecEncSample
->
GetEncEosState
())
{};
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopDec
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
StopEnc
());
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseEnc
());
videoEnc
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
ReleaseDec
());
videoDec
=
nullptr
;
OH_AVFormat_Destroy
(
VideoFormat
);
VideoFormat
=
nullptr
;
ASSERT_EQ
(
AV_ERR_OK
,
vDecEncSample
->
CalcuError
());
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录