Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1f5144bc
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看板
未验证
提交
1f5144bc
编写于
11月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6435 audio error code
Merge pull request !6435 from wangtao/mon-dev
上级
e41a3943
eceee9bb
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
5078 addition
and
1022 deletion
+5078
-1022
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
...dard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
+120
-0
multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js
.../AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js
+181
-0
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
...dard/audioManager/src/main/js/test/AudioFramework.test.js
+707
-1
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js
...rd/audioManager/src/main/js/test/AudioManagerApi9.test.js
+1200
-36
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js
...dard/audioRenderer/src/main/js/test/AudioRenderer.test.js
+2870
-985
未找到文件。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
浏览文件 @
1f5144bc
...
...
@@ -45,6 +45,8 @@ describe('audioCapturer', function () {
const
GET_STREAMINFO_EVENT
=
'
getStreamInfo
'
;
const
GET_AUDIOSCENE_EVENT
=
'
getAudioScene
'
;
const
ERROR_EVENT
=
'
error
'
;
let
stringParameter
=
"
invalid_parameter
"
;
let
numberParameter
=
999999
;
let
eventEmitter
=
new
events
.
EventEmitter
();
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -1940,6 +1942,68 @@ describe('audioCapturer', function () {
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200
*@tc.name : AudioCapturer-GET_AUDIO_TIME
*@tc.desc : AudioCapturer GET_AUDIO_TIME
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200
'
,
2
,
async
function
(
done
)
{
await
getFd
(
"
capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
"
);
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
0
}
let
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
audioCapPromise
;
try
{
audioCapPromise
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
console
.
log
(
`
${
Tag
}
createAudioCapturer ok`
);
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
createAudioCapturer err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
return
done
();
}
try
{
await
audioCapPromise
.
start
();
console
.
log
(
`
${
Tag
}
start ok`
);
let
audioTime
=
await
audioCapPromise
.
getAudioTime
();
console
.
log
(
`
${
Tag
}
audioTime:
${
JSON
.
stringify
(
audioTime
)}
`
);
expect
(
audioTime
).
assertLarger
(
0
);
await
audioCapPromise
.
read
(
stringParameter
,
true
);
}
catch
(
err
)
{
if
(
err
.
code
==
6800101
)
{
console
.
log
(
`audioVolumeManager on : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`audioVolumeManager on : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
}
try
{
await
audioCapPromise
.
release
();
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME
...
...
@@ -2040,6 +2104,62 @@ describe('audioCapturer', function () {
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME
*@tc.desc : AudioCapturer GET_AUDIO_TIME
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100
'
,
2
,
async
function
(
done
)
{
await
getFd
(
"
capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm
"
);
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_MIC
,
capturerFlags
:
0
}
let
AudioCapturerOptions
=
{
streamInfo
:
AudioStreamInfo
,
capturerInfo
:
AudioCapturerInfo
}
let
audioCapPromise
;
try
{
audioCapPromise
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
console
.
log
(
`
${
Tag
}
createAudioCapturer ok`
);
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
createAudioCapturer err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
return
done
();
}
try
{
await
audioCapPromise
.
stop
();
}
catch
(
err
)
{
if
(
err
.
code
==
6800301
)
{
console
.
log
(
`
${
Tag
}
stop error code : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`
${
Tag
}
stop error code : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
}
try
{
await
audioCapPromise
.
release
();
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME
...
...
multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js
浏览文件 @
1f5144bc
...
...
@@ -19,6 +19,11 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe
(
'
audioTonePlayer
'
,
function
()
{
let
tonePlayerCallback
=
null
;
let
name
;
let
TagTone
=
'
AudioTonePlayerTest
'
;
let
stringParameter
=
"
invalid_parameter
"
;
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
beforeAll
(
function
(){
console
.
log
(
'
beforeAll test suit is executed
'
);
})
...
...
@@ -1128,4 +1133,180 @@ describe('audioTonePlayer',function() {
},
2000
)
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_CREATETONEPLAYER_0100
*@tc.name : AudioTonePlayer-create
*@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_CREATETONEPLAYER_0100
'
,
2
,
function
(
done
)
{
audio
.
createTonePlayer
(
stringParameter
).
then
(
async
(
result
)
=>
{
console
.
info
(
"
recPromiseFail call createTonePlayer-----result:
"
+
JSON
.
stringify
(
result
));
await
result
.
release
().
then
(()
=>
{
console
.
info
(
'
recPromiseFail TonePlayer : RELEASE SUCCESS
'
);
console
.
info
(
'
recPromiseFail ---------RELEASE---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call release fail
"
+
JSON
.
stringify
(
err
));
});
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
err :
'
+
err
.
code
)
if
(
err
.
code
==
6800101
)
{
console
.
log
(
`
${
TagTone
}
: load : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`
${
TagTone
}
: load : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_CREATETONEPLAYER_0100
*@tc.name : AudioTonePlayer-create
*@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_CREATETONEPLAYER_0200
'
,
2
,
function
(
done
)
{
audio
.
createTonePlayer
(
stringParameter
,
async
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
'
err :
'
+
err
.
code
)
if
(
err
.
code
==
6800101
)
{
console
.
log
(
`
${
TagTone
}
: load : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`
${
TagTone
}
: load : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
}
else
{
await
data
.
release
().
then
(()
=>
{
console
.
info
(
'
recPromiseFail TonePlayer : RELEASE SUCCESS
'
);
console
.
info
(
'
recPromiseFail ---------RELEASE---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call release fail
"
+
JSON
.
stringify
(
err
));
});
expect
(
false
).
assertTrue
();
}
done
();
})
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_LOAD_0100
*@tc.name : AudioTonePlayer-create-load-stop-release success
*@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_TONEPLAYER_LOAD_0100
'
,
2
,
async
function
(
done
)
{
let
tPlayer
=
null
;
let
audioRendererInfo
=
{
"
contentType
"
:
audio
.
ContentType
.
CONTENT_TYPE_SONIFICATION
,
"
streamUsage
"
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
"
rendererFlags
"
:
0
}
await
audio
.
createTonePlayer
(
audioRendererInfo
).
then
((
result
)
=>
{
console
.
info
(
"
recPromiseFail call createTonePlayer-----result:
"
+
JSON
.
stringify
(
result
));
tPlayer
=
result
;
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call createTonePlayer fail err:
"
+
JSON
.
stringify
(
err
)
+
'
tPlayer:
'
+
tPlayer
);
console
.
error
(
"
recPromiseFail call createTonePlayer ---fail
"
);
});
await
tPlayer
.
load
(
stringParameter
).
then
(()
=>
{
console
.
info
(
'
AudioFrameworkRecLog: ---------LOAD---------
'
);
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
err :
'
+
err
.
code
)
if
(
err
.
code
==
6800101
)
{
console
.
log
(
`
${
TagTone
}
: load : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`
${
TagTone
}
: load : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
});
await
tPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
AudioFrameworkRecLog: TonePlayer : STOP SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------STOP---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`promise call stop ---fail error.
${
err
.
message
}
`
);
});
await
tPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
recPromiseFail TonePlayer : RELEASE SUCCESS
'
);
console
.
info
(
'
recPromiseFail ---------RELEASE---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call release fail
"
+
JSON
.
stringify
(
err
));
});
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_LOAD_0200
*@tc.name : AudioTonePlayer-create-load-stop-release success
*@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_TONEPLAYER_LOAD_0200
'
,
2
,
async
function
(
done
)
{
let
time1
=
(
new
Date
()).
getTime
();
let
tPlayer
=
null
;
let
audioRendererInfo
=
{
"
contentType
"
:
audio
.
ContentType
.
CONTENT_TYPE_SONIFICATION
,
"
streamUsage
"
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
"
rendererFlags
"
:
0
}
await
audio
.
createTonePlayer
(
audioRendererInfo
).
then
((
result
)
=>
{
console
.
info
(
"
recPromiseFail call createTonePlayer-----result:
"
+
JSON
.
stringify
(
result
));
tPlayer
=
result
;
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call createTonePlayer fail err:
"
+
JSON
.
stringify
(
err
)
+
'
tPlayer:
'
+
tPlayer
);
console
.
error
(
"
recPromiseFail call createTonePlayer ---fail
"
);
});
await
tPlayer
.
load
(
stringParameter
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
'
err :
'
+
err
.
code
)
if
(
err
.
code
==
6800101
)
{
console
.
log
(
`
${
TagTone
}
: load : PASS : message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
log
(
`
${
TagTone
}
: load : FAIL : message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
}
else
{
console
.
info
(
'
AudioFrameworkRecLog: ---------LOAD---------
'
);
expect
(
false
).
assertTrue
();
}
});
await
sleep
(
1000
);
await
tPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
AudioFrameworkRecLog: TonePlayer : STOP SUCCESS
'
);
console
.
info
(
'
AudioFrameworkRecLog: ---------STOP---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`promise call stop ---fail error.
${
err
.
message
}
`
);
});
await
tPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
recPromiseFail TonePlayer : RELEASE SUCCESS
'
);
console
.
info
(
'
recPromiseFail ---------RELEASE---------
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
recPromiseFail call release fail
"
+
JSON
.
stringify
(
err
));
});
let
time2
=
(
new
Date
).
getTime
();
console
.
info
(
'
time:
'
+
(
time2
-
time1
));
done
();
})
})
\ No newline at end of file
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js
浏览文件 @
1f5144bc
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js
浏览文件 @
1f5144bc
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js
浏览文件 @
1f5144bc
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录