Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d6e31590
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看板
提交
d6e31590
编写于
1月 24, 2022
作者:
L
ling990
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify Signed-off-by: ling990 <liling96@huawei.com>
Signed-off-by:
N
ling990
<
liling96@huawei.com
>
上级
88c15291
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
97 addition
and
66 deletion
+97
-66
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
...c/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
+33
-31
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
...oder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
+26
-0
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
...c/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
+38
-35
未找到文件。
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
浏览文件 @
d6e31590
...
...
@@ -146,6 +146,7 @@ describe('AudioDecoderReliabilityPromise', function () {
"
sample_rate
"
:
44100
,
"
audio_raw_format
"
:
4
,
};
let
expectError
=
false
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -257,6 +258,7 @@ describe('AudioDecoderReliabilityPromise', function () {
381
,
410
,
394
,
386
,
345
,
345
,
354
,
397
,
386
,
375
,
390
,
347
,
411
,
381
,
383
,
374
,
379
,
380
,
378
,
391
,
380
,
339
,
390
,
383
,
375
];
ES_LENGTH
=
500
;
expectError
=
false
;
})
afterEach
(
function
()
{
...
...
@@ -267,7 +269,6 @@ describe('AudioDecoderReliabilityPromise', function () {
wait
(
2000
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -277,6 +278,12 @@ describe('AudioDecoderReliabilityPromise', function () {
expect
(
err
).
assertUndefined
();
}
let
failCallbackTrue
=
function
(
err
,
mySteps
,
done
)
{
console
.
info
(
'
case callback err :
'
+
err
);
expect
(
err
!=
undefined
).
assertTrue
();
nextStep
(
mySteps
,
done
);
}
let
failCatch
=
function
(
err
)
{
console
.
info
(
'
case catch err :
'
+
err
);
expect
(
err
).
assertUndefined
();
...
...
@@ -303,7 +310,7 @@ describe('AudioDecoderReliabilityPromise', function () {
audioDecodeProcessor
=
processor
;
setCallback
(
savepath
,
done
);
console
.
info
(
"
case start api test
"
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
})
}
...
...
@@ -353,7 +360,7 @@ describe('AudioDecoderReliabilityPromise', function () {
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
nextStep
(
mySteps
,
mediaDescription
,
done
)
{
function
nextStep
(
mySteps
,
done
)
{
console
.
info
(
"
case myStep[0]:
"
+
mySteps
[
0
]);
if
(
mySteps
[
0
]
==
END
)
{
done
();
...
...
@@ -367,7 +374,7 @@ describe('AudioDecoderReliabilityPromise', function () {
audioDecodeProcessor
.
configure
(
mediaDescription
).
then
(()
=>
{
console
.
info
(
`case configure 1`
);
readFile
(
AUDIOPATH
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
PREPARE
:
...
...
@@ -375,7 +382,7 @@ describe('AudioDecoderReliabilityPromise', function () {
console
.
info
(
`case to prepare`
);
audioDecodeProcessor
.
prepare
().
then
(()
=>
{
console
.
info
(
`case prepare 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
START
:
...
...
@@ -389,7 +396,7 @@ describe('AudioDecoderReliabilityPromise', function () {
}
audioDecodeProcessor
.
start
().
then
(()
=>
{
console
.
info
(
`case start 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
FLUSH
:
...
...
@@ -403,7 +410,7 @@ describe('AudioDecoderReliabilityPromise', function () {
workdoneAtEOS
=
true
;
flushAtEOS
=
false
;
}
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
STOP
:
...
...
@@ -411,7 +418,7 @@ describe('AudioDecoderReliabilityPromise', function () {
console
.
info
(
`case to stop`
);
audioDecodeProcessor
.
stop
().
then
(()
=>
{
console
.
info
(
`case stop 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
RESET
:
...
...
@@ -419,13 +426,13 @@ describe('AudioDecoderReliabilityPromise', function () {
console
.
info
(
`case to reset`
);
audioDecodeProcessor
.
reset
().
then
(()
=>
{
console
.
info
(
`case reset 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
HOLDON
:
mySteps
.
shift
();
setTimeout
(()
=>
{
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
WAITTIME
);
break
;
case
WAITFORALLOUTS
:
...
...
@@ -435,53 +442,48 @@ describe('AudioDecoderReliabilityPromise', function () {
case
CONFIGURE_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to configure 2`
);
audioDecodeProcessor
.
configure
(
mediaDescription
,
(
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
audioDecodeProcessor
.
configure
(
mediaDescription
).
then
(()
=>
{
console
.
info
(
`case configure error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
PREPARE_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to prepare 2`
);
audioDecodeProcessor
.
prepare
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
audioDecodeProcessor
.
prepare
().
then
(()
=>
{
console
.
info
(
`case prepare error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
START_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to start 2`
);
audioDecodeProcessor
.
start
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
audioDecodeProcessor
.
start
().
then
(()
=>
{
console
.
info
(
`case start error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
FLUSH_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to flush 2`
);
audioDecodeProcessor
.
flush
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
audioDecodeProcessor
.
flush
().
then
(()
=>
{
console
.
info
(
`case flush error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
STOP_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to stop 2`
);
audioDecodeProcessor
.
stop
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
audioDecodeProcessor
.
stop
().
then
(()
=>
{
console
.
info
(
`case stop error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
JUDGE_EOS
:
mySteps
.
shift
();
console
.
info
(
`case judge EOS state`
);
expect
(
sawOutputEOS
).
assertTrue
();
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
break
;
default
:
break
;
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
浏览文件 @
d6e31590
...
...
@@ -292,9 +292,35 @@ describe('AudioEncoderFuncPromise', function () {
"
sample_rate
"
:
48000
,
"
audio_raw_format
"
:
16
,
}
let
mediaDescription2
=
{
"
codec_mime
"
:
'
audio/mp4a-latm
'
,
}
let
savepath
=
BASIC_PATH
+
'
0000.txt
'
;
needgetMediaDes
=
true
;
workdoneAtEOS
=
true
;
await
media
.
getMediaCapability
().
then
((
mediaCaps
)
=>
{
console
.
info
(
'
getMediaCapability success
'
);
if
(
typeof
(
mediaCaps
)
!=
'
undefined
'
)
{
await
mediaCaps
.
getAudioEncoderCaps
().
then
((
audioCaps
)
=>
{
console
.
info
(
'
getAudioEncoderCaps success
'
);
if
(
typeof
(
audioCaps
)
!=
'
undefined
'
)
{
console
.
info
(
"
case audioCaps
"
+
audioCaps
);
}
else
{
console
.
info
(
"
case audioCaps is not defined
"
);
}
},
failCallback
).
catch
(
failCatch
);
await
mediaCaps
.
findAudioEncoder
(
mediaDescription2
).
then
((
codecname
)
=>
{
console
.
info
(
'
getAudioEncoderCaps success
'
);
if
(
typeof
(
codecname
)
!=
'
undefined
'
)
{
console
.
info
(
"
case codecname
"
+
codecname
);
}
else
{
console
.
info
(
"
case codecname is not defined
"
);
}
},
failCallback
).
catch
(
failCatch
);
}
else
{
console
.
info
(
'
mediaCaps is not defined
'
);
}
},
failCallback
).
catch
(
failCatch
);
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
console
.
info
(
"
case create createAudioEncoder success
"
);
audioEncodeProcessor
=
processor
;
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
浏览文件 @
d6e31590
...
...
@@ -57,6 +57,7 @@ describe('AudioEncoderSTTPromise', function () {
"
sample_rate
"
:
48000
,
"
audio_raw_format
"
:
16
,
};
let
expectError
=
false
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -78,6 +79,7 @@ describe('AudioEncoderSTTPromise', function () {
inputQueue
=
[];
outputQueue
=
[];
ES_LENGTH
=
200
;
expectError
=
false
;
})
afterEach
(
function
()
{
...
...
@@ -97,6 +99,12 @@ describe('AudioEncoderSTTPromise', function () {
expect
(
err
).
assertUndefined
();
}
let
failCallbackTrue
=
function
(
err
,
mySteps
,
done
)
{
console
.
info
(
'
case callback err :
'
+
err
);
expect
(
err
!=
undefined
).
assertTrue
();
nextStep
(
mySteps
,
done
);
}
let
failCatch
=
function
(
err
)
{
console
.
info
(
'
case catch err :
'
+
err
);
expect
(
err
).
assertUndefined
();
...
...
@@ -121,7 +129,7 @@ describe('AudioEncoderSTTPromise', function () {
audioEncodeProcessor
=
processor
;
setCallback
(
savepath
,
done
);
console
.
info
(
"
case start api test
"
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
}
...
...
@@ -200,7 +208,7 @@ describe('AudioEncoderSTTPromise', function () {
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
nextStep
(
mySteps
,
mediaDescription
,
done
)
{
function
nextStep
(
mySteps
,
done
)
{
console
.
info
(
"
case myStep[0]:
"
+
mySteps
[
0
]);
if
(
mySteps
[
0
]
==
END
)
{
done
();
...
...
@@ -214,7 +222,7 @@ describe('AudioEncoderSTTPromise', function () {
audioEncodeProcessor
.
configure
(
mediaDescription
).
then
(()
=>
{
console
.
info
(
`case configure 1`
);
readFile
(
AUDIOPATH
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
PREPARE
:
...
...
@@ -222,7 +230,7 @@ describe('AudioEncoderSTTPromise', function () {
console
.
info
(
`case to prepare`
);
audioEncodeProcessor
.
prepare
().
then
(()
=>
{
console
.
info
(
`case prepare 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
START
:
...
...
@@ -236,7 +244,7 @@ describe('AudioEncoderSTTPromise', function () {
}
audioEncodeProcessor
.
start
().
then
(()
=>
{
console
.
info
(
`case start 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
FLUSH
:
...
...
@@ -250,7 +258,7 @@ describe('AudioEncoderSTTPromise', function () {
workdoneAtEOS
=
true
;
flushAtEOS
=
false
;
}
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
STOP
:
...
...
@@ -258,7 +266,7 @@ describe('AudioEncoderSTTPromise', function () {
console
.
info
(
`case to stop`
);
audioEncodeProcessor
.
stop
().
then
(()
=>
{
console
.
info
(
`case stop 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
RESET
:
...
...
@@ -266,13 +274,13 @@ describe('AudioEncoderSTTPromise', function () {
console
.
info
(
`case to reset`
);
audioEncodeProcessor
.
reset
().
then
(()
=>
{
console
.
info
(
`case reset 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
failCallback
).
catch
(
failCatch
);
break
;
case
HOLDON
:
mySteps
.
shift
();
setTimeout
(()
=>
{
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
},
WAITTIME
);
break
;
case
WAITFORALLOUTS
:
...
...
@@ -281,54 +289,49 @@ describe('AudioEncoderSTTPromise', function () {
break
;
case
CONFIGURE_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to configure`
);
audioEncodeProcessor
.
configure
(
mediaDescription
,
(
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
console
.
info
(
`case to configure 2`
);
audioEncodeProcessor
.
configure
(
mediaDescription
).
then
(()
=>
{
console
.
info
(
`case configure error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
PREPARE_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to prepare`
);
audioEncodeProcessor
.
prepare
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
console
.
info
(
`case to prepare 2`
);
audioEncodeProcessor
.
prepare
().
then
(()
=>
{
console
.
info
(
`case prepare error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
START_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to start`
);
audioEncodeProcessor
.
start
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
console
.
info
(
`case to start 2`
);
audioEncodeProcessor
.
start
().
then
(()
=>
{
console
.
info
(
`case start error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
FLUSH_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to flush`
);
audioEncodeProcessor
.
flush
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
console
.
info
(
`case to flush 2`
);
audioEncodeProcessor
.
flush
().
then
(()
=>
{
console
.
info
(
`case flush error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
STOP_ERROR
:
mySteps
.
shift
();
console
.
info
(
`case to stop`
);
audioEncodeProcessor
.
stop
((
err
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
console
.
info
(
`case to stop 2`
);
audioEncodeProcessor
.
stop
().
then
(()
=>
{
console
.
info
(
`case stop error 1`
);
nextStep
(
mySteps
,
mediaDescription
,
done
);
});
expect
(
expectError
).
assertTrue
(
);
}
,
(
err
)
=>
{
failCallbackTrue
(
err
,
mySteps
,
done
)}).
catch
(
failCatch
);
break
;
case
JUDGE_EOS
:
mySteps
.
shift
();
console
.
info
(
`case judge EOS state`
);
expect
(
sawOutputEOS
).
assertTrue
();
nextStep
(
mySteps
,
mediaDescription
,
done
);
nextStep
(
mySteps
,
done
);
break
;
default
:
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录