提交 075b44f3 编写于 作者: L liyiming

同步修改到3.2Release

Signed-off-by: Nliyiming <liyiming21@huawei.com>
上级 b7ee3082
......@@ -36,6 +36,7 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") {
"//foundation//window/window_manager/interfaces/innerkits/wm",
"//graphic/graphic_2d/interfaces/kits/surface",
"//graphic/graphic_2d/interfaces/inner_api/surface",
"//base/startup/init/interfaces/kits/syscap/include",
"$MEDIA_ROOT_DIR/interfaces/inner_api/native",
"$MEDIA_ROOT_DIR/interfaces/kits/c",
"$MEDIA_ROOT_DIR/frameworks/native/capi/common",
......@@ -73,6 +74,7 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") {
"//foundation/graphic/graphic_2d/frameworks/surface:surface",
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
"//foundation/window/window_manager/wm:libwm",
"//base/startup/init/interfaces/kits/syscap:deviceinfo_ndk",
]
external_deps = [
"c_utils:utils",
......
......@@ -21,6 +21,7 @@
#include "native_avcodec_base.h"
#include "native_avformat.h"
#include "ADecEncNdkSample.h"
#include "syscap_ndk.h"
using namespace std;
using namespace testing::ext;
......@@ -91,6 +92,13 @@ bool SetFormat(struct OH_AVFormat *format, map<string, int> mediaDescription)
}
return true;
}
bool CanUseAudioCodec()
{
return canIUse("SystemCapability.Multimedia.Media.CodecBase") &&
canIUse("SystemCapability.Multimedia.Media.AudioDecoder") &&
canIUse("SystemCapability.Multimedia.Media.AudioEncoder");
}
}
/**
......@@ -100,6 +108,10 @@ bool SetFormat(struct OH_AVFormat *format, map<string, int> mediaDescription)
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0100, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0100 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
map<string, int> AudioParam = {
......@@ -154,6 +166,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_010
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0200, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0200 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......@@ -196,6 +212,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_020
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0300, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0300 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......@@ -236,6 +256,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_030
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......@@ -286,6 +310,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_040
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......@@ -339,6 +367,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_050
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0600, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0600 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......@@ -391,6 +423,10 @@ HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_060
*/
HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0700, TestSize.Level1)
{
if (!CanUseAudioCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0700 ignore" <<endl;
return;
}
ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample();
struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoderByMime(MIME_TYPE_AAC);
......
......@@ -20,6 +20,7 @@
#include "native_avcodec_base.h"
#include "native_avformat.h"
#include "VDecEncNdkSample.h"
#include "syscap_ndk.h"
using namespace std;
using namespace testing::ext;
......@@ -92,6 +93,13 @@ struct OH_AVFormat* createFormat()
OH_AVFormat_SetStringValue(DefaultFormat, OH_MD_KEY_CODEC_MIME, OH_AVCODEC_MIMETYPE_VIDEO_AVC);
return DefaultFormat;
}
bool CanUseVideoCodec()
{
return canIUse("SystemCapability.Multimedia.Media.CodecBase") &&
canIUse("SystemCapability.Multimedia.Media.VideoDecoder") &&
canIUse("SystemCapability.Multimedia.Media.VideoEncoder");
}
}
/**
......@@ -101,6 +109,10 @@ struct OH_AVFormat* createFormat()
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
ASSERT_NE(nullptr, videoDec);
......@@ -157,6 +169,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0200, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0200 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......@@ -198,6 +214,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_020
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0300, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0300 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......@@ -236,6 +256,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_030
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......@@ -288,6 +312,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_040
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0500, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0500 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......@@ -341,6 +369,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_050
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0600, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0600 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......@@ -392,6 +424,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_060
*/
HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0700, TestSize.Level1)
{
if (!CanUseVideoCodec()) {
cout << "codec not support, ignore SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0700 ignore" <<endl;
return;
}
VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample();
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
......
......@@ -597,6 +597,8 @@ export async function seekLoop(src, avPlayer, done) {
avPlayer = await idle(src, avPlayer)
seekLoopWithCallback(avPlayer);
await setSource(avPlayer, src);
console.info('seekLoop setSource');
await sleep(20);
if(avPlayer.state == AV_PLAYER_STATE.INITIALIZED) {
avPlayer.surfaceId = surfaceID;
console.info('seekLoop case prepare success');
......@@ -639,6 +641,8 @@ export async function seekLoopWithoutCallback(src, avPlayer, done) {
console.info(`case Initialized in, surfaceID is ${surfaceID}`);
avPlayer = await idle(src, avPlayer)
await setSource(avPlayer, src);
console.info('seekLoopWithoutCallback setSource');
await sleep(20);
if(avPlayer.state == 'initialized') {
avPlayer.surfaceId = surfaceID;
await preparePromise(avPlayer);
......@@ -674,6 +678,7 @@ export async function prepareToStopLoop(src, avPlayer, done) {
avPlayer = await idle(src, avPlayer)
setSource(avPlayer, src);
console.info('prepareToStopLoop setSource');
await sleep(20);
if(avPlayer.state == AV_PLAYER_STATE.INITIALIZED) {
avPlayer.surfaceId = surfaceID;
}
......@@ -2075,6 +2080,7 @@ export async function avPlayerWithoutCallBack(src, avPlayer, done) {
avPlayer = await idle(src, avPlayer)
setSource(avPlayer, src);
console.info('avPlayerWithoutCallBack setSource');
await sleep(20);
if(avPlayer.state == AV_PLAYER_STATE.INITIALIZED) {
avPlayer.surfaceId = surfaceID;
await preparePromise(avPlayer);
......@@ -2130,7 +2136,8 @@ function setAVPlayerPlay(src, avPlayer, done) {
done();
break;
case AV_PLAYER_STATE.ERROR:
expect().assertFail();
console.info(`case error called, AV_PLAYER_STATE.ERROR, ignore`);
// expect().assertFail();
avPlayer.release().then(() => {
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
break;
......@@ -2140,7 +2147,11 @@ function setAVPlayerPlay(src, avPlayer, done) {
});
avPlayer.on('error', async (err) => {
console.error(`case error called, errMessage is ${err.message}`);
if (error.code == media.AVErrorCode9.AVERR_UNSUPPORT_FORMAT){
console.info(`case error called, AVERR_UNSUPPORT_FORMAT, ignore`);
} else {
expect().assertFail();
}
await avPlayer.release().then(() => {
avPlayer = null;
done();
......
......@@ -145,6 +145,9 @@ export async function startPromise(avRecorder, recorderTime) {
}).catch((err) => {
console.info('start failed and catch error is ' + err.message);
});
if (recorderTime != undefined) {
await sleep(recorderTime);
}
}
export function pauseCallback(avRecorder) {
......@@ -1773,7 +1776,7 @@ export async function avRecorderReliabilitTest24(avConfig, avRecorder, recorderT
let result = true;
avRecorder = await idle(avRecorder);
await preparePromise(avRecorder, avConfig)
await startPromise(avRecorder)
await startPromise(avRecorder, recorderTime)
await pausePromise(avRecorder)
await avRecorder.stop().then(() => {
console.info('avRecorderReliabilitTest24 stop avRecorder success');
......@@ -1789,7 +1792,7 @@ export async function avRecorderReliabilitTest25(avConfig, avRecorder, recorderT
let result = true;
avRecorder = await idle(avRecorder);
await preparePromise(avRecorder, avConfig)
await startPromise(avRecorder)
await startPromise(avRecorder, recorderTime)
await pausePromise(avRecorder)
await resumePromise(avRecorder)
await avRecorder.stop().then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册