Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f8482be7
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看板
提交
f8482be7
编写于
3月 23, 2022
作者:
L
ling990
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify testcases Signed-off-by: ling990 <liling96@huawei.com>
Signed-off-by:
N
ling990
<
ling990@qq.com
>
上级
190cbd06
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
489 addition
and
559 deletion
+489
-559
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js
...udioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js
+0
-1
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityCallbackTest.test.js
.../main/js/test/AudioDecoderReliabilityCallbackTest.test.js
+1
-2
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
...c/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
+1
-2
multimedia/media/media_js_standard/audioEncoder/Test.json
multimedia/media/media_js_standard/audioEncoder/Test.json
+2
-3
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js
...der/src/main/js/test/AudioEncoderFuncCallbackTest.test.js
+41
-38
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
...oder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
+41
-40
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderMultiInstancesTest.test.js
...r/src/main/js/test/AudioEncoderMultiInstancesTest.test.js
+9
-6
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityCallbackTest.test.js
.../main/js/test/AudioEncoderReliabilityCallbackTest.test.js
+9
-11
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
...c/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
+9
-11
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js
...ideoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js
+39
-48
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncCallbackTest.test.js
...der/src/main/js/test/VideoDecoderFuncCallbackTest.test.js
+48
-58
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js
...oder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js
+39
-49
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliCallbackTest.test.js
...der/src/main/js/test/VideoDecoderReliCallbackTest.test.js
+35
-45
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliPromiseTest.test.js
...oder/src/main/js/test/VideoDecoderReliPromiseTest.test.js
+37
-47
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js
...main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js
+41
-51
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js
.../main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js
+33
-43
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js
...main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js
+35
-45
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js
.../main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js
+37
-47
multimedia/media/media_js_standard/videoEncoder/Test.json
multimedia/media/media_js_standard/videoEncoder/Test.json
+1
-1
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderMultiInstancesTest.test.js
...r/src/main/js/test/VideoEncoderMultiInstancesTest.test.js
+3
-9
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js
...main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js
+6
-0
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js
.../main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js
+6
-0
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js
.../test/VideoEncoderSoftwareReliabilityCallbackTest.test.js
+8
-0
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js
...s/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js
+8
-2
未找到文件。
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js
浏览文件 @
f8482be7
...
...
@@ -28,7 +28,6 @@ describe('AudioDecoderEnum', function () {
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
wait
(
2000
);
})
afterAll
(
function
()
{
...
...
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -538,8 +538,7 @@ describe('AudioDecoderReliabilityCallback', function () {
}
}
else
{
writeFile
(
savepath
,
outputobject
.
data
,
outputobject
.
length
);
console
.
info
(
"
write to file success
"
);
console
.
info
(
"
not last frame, continue
"
);
}
audioDecodeProcessor
.
freeOutputBuffer
(
outputobject
,
()
=>
{
console
.
info
(
'
release output success
'
);
...
...
multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -541,8 +541,7 @@ describe('AudioDecoderReliabilityPromise', function () {
}
}
else
{
writeFile
(
savapath
,
outputobject
.
data
,
outputobject
.
length
);
console
.
info
(
"
write to file success
"
);
console
.
info
(
"
not last frame, continue
"
);
}
audioDecodeProcessor
.
freeOutputBuffer
(
outputobject
).
then
(()
=>
{
console
.
info
(
'
release output success
'
);
...
...
multimedia/media/media_js_standard/audioEncoder/Test.json
浏览文件 @
f8482be7
{
"description"
:
"Configuration for audio
Play
er Tests"
,
"description"
:
"Configuration for audio
Encod
er Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"2000000"
,
...
...
@@ -19,8 +19,7 @@
"pre-push"
:
[
],
"push"
:
[
"./resource/audio/audioEncode/S32LE.pcm ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/"
,
"./resource/audio/audioEncode/S32LE_2.pcm ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/"
"./resource/audio/audioEncode/S16LE.pcm ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/"
]
},
{
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -19,8 +19,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe
(
'
AudioEncoderFuncCallback
'
,
function
()
{
const
RESOURCEPATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/
'
const
AUDIOPATH
=
RESOURCEPATH
+
'
S32LE.pcm
'
;
const
AUDIOPATH2
=
RESOURCEPATH
+
'
S32LE_2.pcm
'
;
const
AUDIOPATH
=
RESOURCEPATH
+
'
S16LE.pcm
'
;
const
BASIC_PATH
=
RESOURCEPATH
+
'
results/encode_func_callback_
'
;
let
audioEncodeProcessor
;
let
readStreamSync
;
...
...
@@ -139,8 +138,8 @@ describe('AudioEncoderFuncCallback', function () {
console
.
info
(
"
start add ADTS to Packet
"
);
let
packetLen
=
len
+
7
;
// 7: head length
let
profile
=
2
;
// 2: AAC LC
let
freqIdx
=
3
;
// 3: 480
00HZ
let
chanCfg
=
1
;
// 1: 1
channel
let
freqIdx
=
4
;
// 4: 441
00HZ
let
chanCfg
=
2
;
// 2: 2
channel
view
[
0
]
=
0xFF
;
view
[
1
]
=
0xF9
;
view
[
2
]
=
((
profile
-
1
)
<<
6
)
+
(
freqIdx
<<
2
)
+
(
chanCfg
>>
2
);
...
...
@@ -163,7 +162,11 @@ describe('AudioEncoderFuncCallback', function () {
expect
(
err
).
assertUndefined
();
console
.
info
(
"
case reset success
"
);
if
(
needrelease
)
{
audioEncodeProcessor
=
null
audioEncodeProcessor
.
release
((
err
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
"
case release success
"
);
audioEncodeProcessor
=
null
;
})
}
})
}
...
...
@@ -299,14 +302,14 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
mediaDescription2
=
{
"
codec_mime
"
:
'
audio/mp4a-latm
'
,
}
let
savepath
=
BASIC_PATH
+
'
callback0000.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0000.
aac
'
;
needGetMediaDes
=
true
;
workdoneAtEOS
=
true
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
...
...
@@ -382,11 +385,11 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0100.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0100.
aac
'
;
eosframenum
=
500
;
workdoneAtEOS
=
true
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
...
...
@@ -440,11 +443,11 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0200.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0200.
aac
'
;
workdoneAtEOS
=
true
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
audioEncodeProcessor
.
getAudioEncoderCaps
((
err
,
Audiocaps
)
=>
{
...
...
@@ -506,11 +509,11 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0300.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0300.
aac
'
;
eosframenum
=
500
;
flushAtEOS
=
true
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
...
...
@@ -564,11 +567,11 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0400.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0400.
aac
'
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
audioEncodeProcessor
.
getAudioEncoderCaps
((
err
,
Audiocaps
)
=>
{
expect
(
err
).
assertUndefined
();
...
...
@@ -646,11 +649,11 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0500.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0500.
aac
'
;
eosframenum
=
100
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
audioEncodeProcessor
.
getAudioEncoderCaps
((
err
,
Audiocaps
)
=>
{
...
...
@@ -725,17 +728,17 @@ describe('AudioEncoderFuncCallback', function () {
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
callback0600.
es
'
;
let
savepath
=
BASIC_PATH
+
'
callback0600.
aac
'
;
eosframenum
=
100
;
resetAtEOS
=
true
;
let
mediaDescription2
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
hasreconfigured
=
false
;
eventEmitter
.
on
(
'
getAudioEncoderCaps
'
,
()
=>
{
...
...
@@ -777,8 +780,8 @@ describe('AudioEncoderFuncCallback', function () {
expect
(
err
).
assertUndefined
();
console
.
info
(
`case configure 2`
);
resetParam
();
readFile
(
AUDIOPATH
2
)
savepath
=
BASIC_PATH
+
'
callback0601.
es
'
;
readFile
(
AUDIOPATH
)
savepath
=
BASIC_PATH
+
'
callback0601.
aac
'
;
workdoneAtEOS
=
true
;
hasreconfigured
=
true
;
eventEmitter
.
emit
(
'
prepare
'
);
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -19,8 +19,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe
(
'
AudioEncoderFuncPromise
'
,
function
()
{
const
RESOURCEPATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/
'
const
AUDIOPATH
=
RESOURCEPATH
+
'
S32LE.pcm
'
;
const
AUDIOPATH2
=
RESOURCEPATH
+
'
S32LE_2.pcm
'
;
const
AUDIOPATH
=
RESOURCEPATH
+
'
S16LE.pcm
'
;
const
BASIC_PATH
=
RESOURCEPATH
+
'
results/encode_func_promise_
'
;
let
audioEncodeProcessor
;
let
readStreamSync
;
...
...
@@ -38,7 +37,7 @@ describe('AudioEncoderFuncPromise', function () {
let
inputQueue
=
[];
let
outputQueue
=
[];
const
ES
=
[
0
,
4096
];
let
ES_LENGTH
=
20
00
;
let
ES_LENGTH
=
15
00
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -61,7 +60,7 @@ describe('AudioEncoderFuncPromise', function () {
sawOutputEOS
=
false
;
inputQueue
=
[];
outputQueue
=
[];
ES_LENGTH
=
20
00
;
ES_LENGTH
=
15
00
;
})
afterEach
(
async
function
()
{
...
...
@@ -150,8 +149,8 @@ describe('AudioEncoderFuncPromise', function () {
console
.
info
(
"
start add ADTS to Packet
"
);
let
packetLen
=
len
+
7
;
// 7: head length
let
profile
=
2
;
// 2: AAC LC
let
freqIdx
=
3
;
// 3: 480
00HZ
let
chanCfg
=
1
;
// 1: 1
channel
let
freqIdx
=
4
;
// 4: 441
00HZ
let
chanCfg
=
2
;
// 2: 2
channel
view
[
0
]
=
0xFF
;
view
[
1
]
=
0xF9
;
view
[
2
]
=
((
profile
-
1
)
<<
6
)
+
(
freqIdx
<<
2
)
+
(
chanCfg
>>
2
);
...
...
@@ -172,6 +171,9 @@ describe('AudioEncoderFuncPromise', function () {
await
audioEncodeProcessor
.
reset
().
then
(()
=>
{
console
.
info
(
"
case reset success
"
);
if
(
needrelease
)
{
await
audioEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
"
case release success
"
);
},
failCallback
).
catch
(
failCatch
);
audioEncodeProcessor
=
null
;
}
},
failCallback
).
catch
(
failCatch
);
...
...
@@ -202,7 +204,6 @@ describe('AudioEncoderFuncPromise', function () {
audioEncodeProcessor
=
null
;
}
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
...
...
@@ -304,14 +305,14 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_00_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test set EOS after last frame and reset
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
mediaDescription2
=
{
"
codec_mime
"
:
'
audio/mp4a-latm
'
,
}
let
savepath
=
BASIC_PATH
+
'
0000.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0000.
aac
'
;
needgetMediaDes
=
true
;
workdoneAtEOS
=
true
;
await
media
.
getMediaCapability
().
then
((
mediaCaps
)
=>
{
...
...
@@ -369,11 +370,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test set EOS manually before last frame and reset
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0100.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0100.
aac
'
;
eosframenum
=
500
;
workdoneAtEOS
=
true
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
...
...
@@ -408,11 +409,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test flush at running state
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0200.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0200.
aac
'
;
workdoneAtEOS
=
true
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
console
.
info
(
"
case create createAudioEncoder success
"
);
...
...
@@ -453,11 +454,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test flush at EOS state
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0300.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0300.
aac
'
;
eosframenum
=
500
;
flushAtEOS
=
true
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
...
...
@@ -492,11 +493,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test stop at running state and reset
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0400.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0400.
aac
'
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
console
.
info
(
"
case create createAudioEncoder success
"
);
audioEncodeProcessor
=
processor
;
...
...
@@ -542,11 +543,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test stop and restart
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0500.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0500.
aac
'
;
eosframenum
=
100
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
console
.
info
(
"
case create createAudioEncoder success
"
);
...
...
@@ -596,11 +597,11 @@ describe('AudioEncoderFuncPromise', function () {
it
(
'
SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
case test reconfigure for new file with the same format
"
);
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
let
savepath
=
BASIC_PATH
+
'
0600.
es
'
;
let
savepath
=
BASIC_PATH
+
'
0600.
aac
'
;
eosframenum
=
100
;
resetAtEOS
=
true
;
await
media
.
createAudioEncoderByMime
(
'
audio/mp4a-latm
'
).
then
((
processor
)
=>
{
...
...
@@ -623,9 +624,9 @@ describe('AudioEncoderFuncPromise', function () {
console
.
info
(
"
case start success
"
);
},
failCallback
).
catch
(
failCatch
);
let
mediaDescription2
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
}
await
sleep
(
10000
).
then
(()
=>
{
console
.
info
(
"
start configure 2
"
);
...
...
@@ -633,9 +634,9 @@ describe('AudioEncoderFuncPromise', function () {
await
audioEncodeProcessor
.
configure
(
mediaDescription2
).
then
(()
=>
{
console
.
info
(
"
configure 2 success
"
);
resetParam
();
readFile
(
AUDIOPATH
2
);
readFile
(
AUDIOPATH
);
},
failCallback
).
catch
(
failCatch
);
let
savepath2
=
BASIC_PATH
+
'
0601.
es
'
;
let
savepath2
=
BASIC_PATH
+
'
0601.
aac
'
;
workdoneAtEOS
=
true
;
setCallback
(
savepath2
,
done
);
await
audioEncodeProcessor
.
prepare
().
then
(()
=>
{
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderMultiInstancesTest.test.js
浏览文件 @
f8482be7
...
...
@@ -19,7 +19,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe
(
'
AudioEncoderFuncPromise
'
,
function
()
{
const
RESOURCEPATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/
'
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
32
LE.pcm
'
;
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
16
LE.pcm
'
;
let
readStreamSync
;
let
eosframenum
=
0
;
let
stopAtEOS
=
false
;
...
...
@@ -35,7 +35,7 @@ describe('AudioEncoderFuncPromise', function () {
let
inputQueue
=
[];
let
outputQueue
=
[];
const
ES
=
[
0
,
4096
];
let
ES_LENGTH
=
20
00
;
let
ES_LENGTH
=
15
00
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -57,7 +57,7 @@ describe('AudioEncoderFuncPromise', function () {
sawOutputEOS
=
false
;
inputQueue
=
[];
outputQueue
=
[];
ES_LENGTH
=
20
00
;
ES_LENGTH
=
15
00
;
})
afterEach
(
function
()
{
...
...
@@ -140,8 +140,8 @@ describe('AudioEncoderFuncPromise', function () {
console
.
info
(
"
start add ADTS to Packet
"
);
let
packetLen
=
len
+
7
;
// 7: head length
let
profile
=
2
;
// 2: AAC LC
let
freqIdx
=
3
;
// 3: 480
00HZ
let
chanCfg
=
1
;
// 1: 1
channel
let
freqIdx
=
4
;
// 4: 441
00HZ
let
chanCfg
=
2
;
// 2: 2
channel
view
[
0
]
=
0xFF
;
view
[
1
]
=
0xF9
;
view
[
2
]
=
((
profile
-
1
)
<<
6
)
+
(
freqIdx
<<
2
)
+
(
chanCfg
>>
2
);
...
...
@@ -162,6 +162,9 @@ describe('AudioEncoderFuncPromise', function () {
await
audioEncodeProcessor
.
reset
().
then
(()
=>
{
console
.
info
(
"
case reset success
"
);
if
(
needrelease
)
{
await
audioEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
"
case release success
"
);
},
failCallback
).
catch
(
failCatch
);
audioEncodeProcessor
=
null
;
}
},
failCallback
).
catch
(
failCatch
);
...
...
@@ -309,8 +312,8 @@ describe('AudioEncoderFuncPromise', function () {
},
failCallback
).
catch
(
failCatch
);
await
array
[
j
].
release
().
then
(()
=>
{
console
.
info
(
"
case release success
"
);
array
[
j
]
=
null
;
},
failCallback
).
catch
(
failCatch
);
array
[
j
]
=
null
;
}
done
();
})
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -17,9 +17,9 @@ import media from '@ohos.multimedia.media'
import
Fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
AudioEncoder
STT
Callback
'
,
function
()
{
describe
(
'
AudioEncoder
Reliability
Callback
'
,
function
()
{
const
RESOURCEPATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/
'
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
32
LE.pcm
'
;
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
16
LE.pcm
'
;
const
BASIC_PATH
=
RESOURCEPATH
+
'
results/encode_reliability_callback_
'
;
const
END
=
0
;
const
CONFIGURE
=
1
;
...
...
@@ -54,9 +54,9 @@ describe('AudioEncoderSTTCallback', function () {
let
ES_LENGTH
=
200
;
let
mime
=
'
audio/mp4a-latm
'
;
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
};
beforeAll
(
function
()
{
...
...
@@ -86,8 +86,8 @@ describe('AudioEncoderSTTCallback', function () {
if
(
audioEncodeProcessor
!=
null
)
{
await
audioEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
'
audioEncodeProcessor release success
'
);
audioEncodeProcessor
=
null
;
},
failCallback
).
catch
(
failCatch
);
audioEncodeProcessor
=
null
;
}
})
...
...
@@ -165,8 +165,8 @@ describe('AudioEncoderSTTCallback', function () {
console
.
info
(
"
start add ADTS to Packet
"
);
let
packetLen
=
len
+
7
;
// 7: head length
let
profile
=
2
;
// 2: AAC LC
let
freqIdx
=
3
;
// 3: 480
00HZ
let
chanCfg
=
1
;
// 1: 1
channel
let
freqIdx
=
4
;
// 4: 441
00HZ
let
chanCfg
=
2
;
// 2: 2
channel
view
[
0
]
=
0xFF
;
view
[
1
]
=
0xF9
;
view
[
2
]
=
((
profile
-
1
)
<<
6
)
+
(
freqIdx
<<
2
)
+
(
chanCfg
>>
2
);
...
...
@@ -386,9 +386,7 @@ describe('AudioEncoderSTTCallback', function () {
}
}
else
{
writeHead
(
savepath
,
outputobject
.
length
);
writeFile
(
savepath
,
outputobject
.
data
,
outputobject
.
length
);
console
.
info
(
"
write to file success
"
);
console
.
info
(
"
not last frame, continue
"
);
}
audioEncodeProcessor
.
freeOutputBuffer
(
outputobject
,
()
=>
{
console
.
info
(
'
release output success
'
);
...
...
multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -17,9 +17,9 @@ import media from '@ohos.multimedia.media'
import
Fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
AudioEncoder
STT
Promise
'
,
function
()
{
describe
(
'
AudioEncoder
Reliability
Promise
'
,
function
()
{
const
RESOURCEPATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/
'
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
32
LE.pcm
'
;
const
AUDIOPATH
=
RESOURCEPATH
+
'
S
16
LE.pcm
'
;
const
BASIC_PATH
=
RESOURCEPATH
+
'
results/encode_reliability_promise_
'
;
const
END
=
0
;
const
CONFIGURE
=
1
;
...
...
@@ -54,9 +54,9 @@ describe('AudioEncoderSTTPromise', function () {
let
ES_LENGTH
=
200
;
let
mime
=
'
audio/mp4a-latm
'
;
let
mediaDescription
=
{
"
channel_count
"
:
1
,
"
sample_rate
"
:
4
80
00
,
"
audio_sample_format
"
:
3
,
"
channel_count
"
:
2
,
"
sample_rate
"
:
4
41
00
,
"
audio_sample_format
"
:
1
,
};
let
expectError
=
false
;
...
...
@@ -88,8 +88,8 @@ describe('AudioEncoderSTTPromise', function () {
if
(
audioEncodeProcessor
!=
null
)
{
await
audioEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
'
audioEncodeProcessor release success
'
);
audioEncodeProcessor
=
null
;
},
failCallback
).
catch
(
failCatch
);
audioEncodeProcessor
=
null
;
}
})
...
...
@@ -183,8 +183,8 @@ describe('AudioEncoderSTTPromise', function () {
console
.
info
(
"
start add ADTS to Packet
"
);
let
packetLen
=
len
+
7
;
// 7: head length
let
profile
=
2
;
// 2: AAC LC
let
freqIdx
=
3
;
// 3: 480
00HZ
let
chanCfg
=
1
;
// 1: 1
channel
let
freqIdx
=
4
;
// 4: 441
00HZ
let
chanCfg
=
2
;
// 2: 2
channel
view
[
0
]
=
0xFF
;
view
[
1
]
=
0xF9
;
view
[
2
]
=
((
profile
-
1
)
<<
6
)
+
(
freqIdx
<<
2
)
+
(
chanCfg
>>
2
);
...
...
@@ -391,9 +391,7 @@ describe('AudioEncoderSTTPromise', function () {
}
}
else
{
writeHead
(
savepath
,
outputobject
.
length
);
writeFile
(
savepath
,
outputobject
.
data
,
outputobject
.
length
);
console
.
info
(
"
write to file success
"
);
console
.
info
(
"
not last frame, continue
"
);
}
audioEncodeProcessor
.
freeOutputBuffer
(
outputobject
).
then
(()
=>
{
console
.
info
(
'
release output success
'
);
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js
浏览文件 @
f8482be7
...
...
@@ -136,57 +136,50 @@ describe('VideoDecoderEnum', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
(
)
{
async
function
enqueueInputs
(
inputObject
)
{
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
}).
then
(()
=>
{
console
.
info
(
'
in case: setParameter success
'
);
},
failCallback
).
catch
(
failCatch
);
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
}).
then
(()
=>
{
console
.
info
(
'
in case: setParameter success
'
);
},
failCallback
).
catch
(
failCatch
);
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
failCallback
).
catch
(
failCatch
);
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
){
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
async
function
dequeueOutputs
(
nextStep
,
outputObject
){
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
}
function
setCallback
(
nextStep
){
...
...
@@ -204,8 +197,7 @@ describe('VideoDecoderEnum', function () {
console
.
info
(
'
in case: inputBufferAvailable inBuffer.flags:
'
+
inBuffer
.
flags
);
expect
(
inBuffer
.
timeMs
!==
undefined
).
assertTrue
();
console
.
info
(
'
in case: inputBufferAvailable inBuffer.timeMs:
'
+
inBuffer
.
timeMs
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
...
...
@@ -213,8 +205,7 @@ describe('VideoDecoderEnum', function () {
videoDecodeProcessor
.
getOutputMediaDescription
().
then
((
MediaDescription
)
=>
{
console
.
info
(
'
get outputMediaDescription :
'
+
MediaDescription
);
},
failCallback
).
catch
(
failCatch
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -177,74 +177,65 @@ describe('VideoDecoderFuncCallbackTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
(){
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
},
(
err
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
in case: setParameter success
'
);
});
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
in case: queueInput success
'
);
}
else
{
inputObject
.
flags
=
4
;
console
.
info
(
`in case queueInput err called,errMessage is
${
error
.
message
}
`
)
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
},
(
err
)
=>
{
expect
(
err
).
assertUndefined
();
console
.
info
(
'
in case: setParameter success
'
);
});
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
in case: queueInput success
'
);
}
else
{
console
.
info
(
`in case queueInput err called,errMessage is
${
error
.
message
}
`
);
}
})
}
})
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
){
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
}
else
{
console
.
info
(
`in case releaseOutput error called,errMessage is
${
error
.
message
}
`
);
}
})
async
function
dequeueOutputs
(
nextStep
,
outputObject
){
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
}
else
{
console
.
info
(
`in case releaseOutput error called,errMessage is
${
error
.
message
}
`
);
}
})
}
function
setCallback
(
nextStep
){
console
.
info
(
'
in case: setCallback in
'
);
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
...
...
@@ -253,8 +244,7 @@ describe('VideoDecoderFuncCallbackTest', function () {
expect
(
err
).
assertUndefined
();
console
.
info
(
'
get outputMediaDescription :
'
+
MediaDescription
);
});
outputQueue
.
push
(
outBuffer
);
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -188,65 +188,56 @@ describe('VideoDecoderFuncPromiseTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
(){
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
}).
then
(()
=>
{
console
.
info
(
'
in case: setParameter success
'
);
},
failCallback
).
catch
(
failCatch
);
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
if
(
frameCountIn
==
ES_FRAME_SIZE
.
length
/
2
)
{
videoDecodeProcessor
.
setParameter
({
'
bitrate
'
:
6400
,
}).
then
(()
=>
{
console
.
info
(
'
in case: setParameter success
'
);
},
failCallback
).
catch
(
failCatch
);
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
failCallback
).
catch
(
failCatch
);
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
){
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
renderOutputData
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
}
function
setCallback
(
nextStep
){
console
.
info
(
'
in case: setCallback in
'
);
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
...
...
@@ -254,8 +245,7 @@ describe('VideoDecoderFuncPromiseTest', function () {
videoDecodeProcessor
.
getOutputMediaDescription
().
then
((
MediaDescription
)
=>
{
console
.
info
(
'
get outputMediaDescription :
'
+
MediaDescription
);
},
failCallback
).
catch
(
failCatch
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -172,53 +172,45 @@ describe('VideoDecoderReliCallbackTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
()
{
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
console
.
info
(
'
in case: queueInput success
'
);
})
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
console
.
info
(
'
in case: queueInput success
'
);
})
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
)
{
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
doneWork
(
nextStep
);
}
return
;
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
doneWork
(
nextStep
);
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
,
()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
})
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
,
()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
})
}
function
toConfigure
(
mySteps
,
done
,
expectFail
)
{
...
...
@@ -399,14 +391,12 @@ describe('VideoDecoderReliCallbackTest', function () {
function
setCallback
(
nextStep
){
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -177,55 +177,47 @@ describe('VideoDecoderReliPromiseTest', function () {
}
}
/* push inputbuffers into codec */
async
function
enqueueInputs
()
{
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
caseCallback
).
catch
(
failCatch
);
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
caseCallback
).
catch
(
failCatch
);
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
)
{
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
await
doneWork
();
nextStep
();
}
return
;
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
await
doneWork
();
nextStep
();
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
).
then
(()
=>
{
console
.
info
(
'
in case: release output success
'
);
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
caseCallback
).
catch
(
failCatch
);
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
info
(
'
in case: release output success
'
);
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
caseCallback
).
catch
(
failCatch
);
}
function
toConfigure
(
mySteps
,
done
,
failureCallback
,
catchCallback
)
{
...
...
@@ -396,14 +388,12 @@ describe('VideoDecoderReliPromiseTest', function () {
function
setCallback
(
nextStep
){
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -189,73 +189,63 @@ describe('VideoDecoderFuncCallbackTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
(){
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
in case: queueInput success
'
);
}
else
{
inputObject
.
flags
=
4
;
console
.
info
(
`in case queueInput err called,errMessage is
${
error
.
message
}
`
)
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
in case: queueInput success
'
);
}
else
{
console
.
info
(
`in case queueInput err called,errMessage is
${
error
.
message
}
`
);
}
})
}
})
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
){
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
}
else
{
console
.
info
(
`in case releaseOutput error called,errMessage is
${
error
.
message
}
`
);
}
})
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
}
else
{
console
.
info
(
`in case releaseOutput error called,errMessage is
${
error
.
message
}
`
);
}
})
}
function
setCallback
(
nextStep
){
console
.
info
(
'
in case: setCallback in
'
);
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -191,64 +191,54 @@ describe('VideoDecoderFuncPromiseTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
(){
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
failCallback
).
catch
(
failCatch
);
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
16.67
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
-
1
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
failCallback
).
catch
(
failCatch
);
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
){
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
renderOutputData
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
nextStep
();
return
;
}
frameCountOut
++
;
await
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
failCallback
).
catch
(
failCatch
);
}
function
setCallback
(
nextStep
){
console
.
info
(
'
in case: setCallback in
'
);
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -172,53 +172,45 @@ describe('VideoDecoderSoftwareReliCallbackTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
()
{
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
console
.
info
(
'
in case: queueInput success
'
);
})
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
,
(
err
)
=>
{
console
.
info
(
'
in case: queueInput success
'
);
})
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
)
{
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
doneWork
(
nextStep
);
}
return
;
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
doneWork
(
nextStep
);
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
,
()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
})
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
,
()
=>
{
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
})
}
function
toConfigure
(
mySteps
,
done
,
expectFail
)
{
...
...
@@ -400,14 +392,12 @@ describe('VideoDecoderSoftwareReliCallbackTest', function () {
function
setCallback
(
nextStep
){
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -179,55 +179,47 @@ describe('VideoDecoderSoftwareReliPromiseTest', function () {
}
/* push inputbuffers into codec */
async
function
enqueueInputs
()
{
console
.
info
(
'
in case: enqueueInputs in
'
);
while
(
inputQueue
.
length
>
0
&&
!
inputEosFlag
)
{
let
inputObject
=
inputQueue
.
shift
();
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
caseCallback
).
catch
(
failCatch
);
async
function
enqueueInputs
(
inputObject
)
{
console
.
log
(
'
in case: inputObject.index:
'
+
inputObject
.
index
);
if
(
frameCountIn
<
ES_FRAME_SIZE
.
length
)
{
getContent
(
inputObject
.
data
,
position
,
ES_FRAME_SIZE
[
frameCountIn
]);
inputObject
.
timeMs
=
timestamp
;
inputObject
.
offset
=
0
;
inputObject
.
length
=
ES_FRAME_SIZE
[
frameCountIn
];
position
=
position
+
ES_FRAME_SIZE
[
frameCountIn
];
console
.
info
(
'
in case: frameCountIn
'
+
frameCountIn
);
frameCountIn
++
;
timestamp
+=
1000
/
mediaDescription
.
frame_rate
;
}
if
(
isCodecData
)
{
inputObject
.
flags
=
8
;
isCodecData
=
false
;
timestamp
=
0
;
}
else
if
(
frameCountIn
>=
ES_FRAME_SIZE
.
length
||
frameCountIn
==
eosFrameId
)
{
inputObject
.
flags
=
1
;
inputEosFlag
=
true
;
}
else
{
inputObject
.
flags
=
4
;
}
videoDecodeProcessor
.
pushInputData
(
inputObject
).
then
(()
=>
{
console
.
info
(
'
in case: queueInput success
'
);
},
caseCallback
).
catch
(
failCatch
);
}
/* get outputbuffers from codec */
async
function
dequeueOutputs
(
nextStep
)
{
console
.
log
(
'
outputQueue.length:
'
+
outputQueue
.
length
);
while
(
outputQueue
.
length
>
0
){
let
outputObject
=
outputQueue
.
shift
();
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
await
doneWork
();
nextStep
();
}
return
;
async
function
dequeueOutputs
(
nextStep
,
outputObject
)
{
if
(
outputObject
.
flags
==
1
)
{
if
(
workdoneAtEOS
)
{
await
doneWork
();
nextStep
();
}
frameCountOut
++
;
videoDecodeProcessor
.
renderOutputData
(
outputObject
).
then
(()
=>
{
console
.
info
(
'
in case: release output success
'
);
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
caseCallback
).
catch
(
failCatch
);
return
;
}
frameCountOut
++
;
videoDecodeProcessor
.
freeOutputBuffer
(
outputObject
).
then
(()
=>
{
console
.
info
(
'
in case: release output success
'
);
console
.
log
(
'
in case: release output count:
'
+
frameCountOut
);
},
caseCallback
).
catch
(
failCatch
);
}
function
toConfigure
(
mySteps
,
done
,
failureCallback
,
catchCallback
)
{
...
...
@@ -399,14 +391,12 @@ describe('VideoDecoderSoftwareReliPromiseTest', function () {
function
setCallback
(
nextStep
){
videoDecodeProcessor
.
on
(
'
needInputData
'
,
async
(
inBuffer
)
=>
{
console
.
info
(
'
in case: inputBufferAvailable inBuffer.index:
'
+
inBuffer
.
index
);
inputQueue
.
push
(
inBuffer
);
await
enqueueInputs
();
enqueueInputs
(
inBuffer
);
});
videoDecodeProcessor
.
on
(
'
newOutputData
'
,
async
(
outBuffer
)
=>
{
console
.
info
(
'
in case: outputBufferAvailable outBuffer.index:
'
+
outBuffer
.
index
);
outputQueue
.
push
(
outBuffer
);
await
dequeueOutputs
(
nextStep
);
dequeueOutputs
(
nextStep
,
outBuffer
);
});
videoDecodeProcessor
.
on
(
'
error
'
,(
err
)
=>
{
...
...
multimedia/media/media_js_standard/videoEncoder/Test.json
浏览文件 @
f8482be7
{
"description"
:
"Configuration for video
Play
er Tests"
,
"description"
:
"Configuration for video
Encod
er Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"2000000"
,
...
...
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderMultiInstancesTest.test.js
浏览文件 @
f8482be7
...
...
@@ -56,12 +56,6 @@ describe('videoEncoderSoftwareMultiInstances', function () {
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
if
(
videoEncodeProcessor
!=
null
){
await
videoEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
"
case release success
"
);
videoEncodeProcessor
=
null
;
},
failCallback
).
catch
(
failCatch
);
}
})
afterAll
(
function
()
{
...
...
@@ -255,8 +249,8 @@ describe('videoEncoderSoftwareMultiInstances', function () {
async
function
toRelease
()
{
await
videoEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
"
case release success
"
);
videoEncodeProcessor
=
null
;
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
}
...
...
@@ -287,10 +281,10 @@ describe('videoEncoderSoftwareMultiInstances', function () {
for
(
let
j
=
1
;
j
<
3
;
j
++
)
{
await
array
[
j
].
release
().
then
(()
=>
{
console
.
info
(
"
case release encoder
"
+
j
);
array
[
j
]
=
null
;
},
failCallback
).
catch
(
failCatch
);
array
[
j
]
=
null
;
}
console
.
info
(
'
release
16
encoders success
'
);
console
.
info
(
'
release encoders success
'
);
done
();
});
async
function
runCase
()
{
...
...
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -40,6 +40,8 @@ describe('VideoEncoderSoftwareFuncCallbackTest', function () {
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
mediaTest
=
null
;
surfaceID
=
''
;
...
...
@@ -74,6 +76,10 @@ describe('VideoEncoderSoftwareFuncCallbackTest', function () {
expect
(
err
==
undefined
).
assertTrue
();
}
function
msleep
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
function
writeFile
(
path
,
buf
,
len
){
try
{
let
writestream
=
Fileio
.
createStreamSync
(
path
,
'
ab+
'
);
...
...
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -39,6 +39,8 @@ describe('videoSoftwareEncoderFuncPromise', function () {
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
mediaTest
=
null
;
surfaceID
=
''
;
...
...
@@ -76,6 +78,10 @@ describe('videoSoftwareEncoderFuncPromise', function () {
expect
(
err
).
assertUndefined
();
}
function
msleep
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
function
resetParam
()
{
outputQueue
=
[];
outputCnt
=
0
;
...
...
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js
浏览文件 @
f8482be7
...
...
@@ -64,6 +64,8 @@ describe('VideoEncoderSoftwareReliCallbackTest', function () {
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
mediaTest
=
null
;
surfaceID
=
''
;
...
...
@@ -98,6 +100,11 @@ describe('VideoEncoderSoftwareReliCallbackTest', function () {
console
.
error
(
`in case error failCatch called,errMessage is
${
err
.
message
}
`
);
expect
(
err
==
undefined
).
assertTrue
();
}
function
msleep
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
function
printError
(
err
,
expectFail
)
{
expect
((
err
!=
undefined
)
==
expectFail
).
assertTrue
();
if
(
expectFail
==
false
&&
err
!=
undefined
)
{
...
...
@@ -105,6 +112,7 @@ describe('VideoEncoderSoftwareReliCallbackTest', function () {
console
.
error
(
`in case error failCatch called,errMessage is
${
err
.
message
}
`
);
}
}
function
writeFile
(
path
,
buf
,
len
){
try
{
let
writestream
=
Fileio
.
createStreamSync
(
path
,
'
ab+
'
);
...
...
multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js
浏览文件 @
f8482be7
...
...
@@ -67,6 +67,8 @@ describe('videoEncoderReliabilityPromise', function () {
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
msleep
(
1000
).
then
(()
=>
{
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
surfaceID
=
''
;
outputQueue
=
[];
...
...
@@ -86,8 +88,8 @@ describe('videoEncoderReliabilityPromise', function () {
if
(
videoEncodeProcessor
!=
null
)
{
await
videoEncodeProcessor
.
release
().
then
(()
=>
{
console
.
info
(
`case release 1`
);
videoEncodeProcessor
=
null
;
},
failCallback
).
catch
(
failCatch
);
videoEncodeProcessor
=
null
;
}
})
...
...
@@ -111,6 +113,10 @@ describe('videoEncoderReliabilityPromise', function () {
expect
(
err
).
assertUndefined
();
}
function
msleep
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
function
resetParam
()
{
outputQueue
=
[];
outputCnt
=
0
;
...
...
@@ -1353,7 +1359,7 @@ describe('videoEncoderReliabilityPromise', function () {
it
(
'
SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
let
savepath
=
BASIC_PATH
+
'
eos_0500.es
'
;
let
mySteps
=
new
Array
(
CONFIGURE
,
GETSURFACE
,
SETSTREAMPARAM
,
PREPARE
,
START
,
STARTSTREAM
,
HOLDON
,
JUDGE_EOS
,
STOP
,
START
,
STOP
,
STOPSTREAM
,
END
);
JUDGE_EOS
,
STOP
,
START
,
STOP
,
STOPSTREAM
,
RELEASE
,
END
);
frameTotal
=
2
;
createVideoEncoder
(
savepath
,
mySteps
,
done
);
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录