diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 9f84b5b49ff3ca11a2bfa3f720a5aca576ae57c7..27ef23cab6fdc90785e9c9a9482079c2345fe167 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -19,13 +19,10 @@ group("multimedia") { deps = [ "audio/audio_js_standard/audioManager:audio_manager_js_hap", "image/image_js_standard:image_js_hap", - "media/media_js_standard/audioDecoder:audio_decoder_js_hap", - "media/media_js_standard/audioEncoder:audio_encoder_js_hap", "media/media_js_standard/audioPlayer:audio_player_js_hap", "media/media_js_standard/audioRecorder:audio_recorder_js_hap", - "media/media_js_standard/videoDecoder:video_decoder_js_hap", - "media/media_js_standard/videoEncoder:video_encoder_js_hap", "media/media_js_standard/videoPlayer:video_player_js_hap", + #"media/media_js_standard/videoRecorder:video_recorder_js_hap", "medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap", ] diff --git a/multimedia/media/media_js_standard/audioDecoder/BUILD.gn b/multimedia/media/media_js_standard/audioDecoder/BUILD.gn deleted file mode 100644 index 05613d295b1dd675290e2a6764f8acc48f49c966..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("audio_decoder_js_hap") { - hap_profile = "./src/main/config.json" - js2abc = true - deps = [ - ":audio_decoder_js_assets", - ":audio_decoder_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAudioDecoderJsTest" -} -ohos_js_assets("audio_decoder_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("audio_decoder_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/media/media_js_standard/audioDecoder/Test.json b/multimedia/media/media_js_standard/audioDecoder/Test.json deleted file mode 100644 index cedb3b5ec0230c70770278febb34a65d8c720c67..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/Test.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "description": "Configuration for audioDecoder Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "2000000", - "package": "ohos.acts.multimedia.audio.audiodecoder", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAudioDecoderJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/audio/audioDecode/AAC_48000_32_1.aac ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/", - "./resource/audio/audioDecode/AAC_16000_1.aac ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/", - "./resource/audio/audioDecode/FLAC_48000_32_1.flac ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/", - "./resource/audio/audioDecode/mp3.es ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/", - "./resource/audio/audioDecode/vorbis.es ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "rm -R /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/results", - "mkdir -p /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/results/", - "chmod 777 -R /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder", - "chmod 777 /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/*" - ], - "teardown-command":[ - ] - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/audioDecoder/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/audioDecoder/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/config.json b/multimedia/media/media_js_standard/audioDecoder/src/main/config.json deleted file mode 100644 index ac9aca6e85c6993d4aaf474e07f56b6063638fd1..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.audio.audiodecoder", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "iconId": 16777218, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "descriptionId": 16777217, - "visible": true, - "labelId": 16777216, - "icon": "$media:icon", - "name": "ohos.acts.multimedia.audio.audiodecoder.MainAbility", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "homeAbility": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "mainAbility": "ohos.acts.multimedia.audio.audiodecoder.MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "ohos.acts.multimedia.audio.audiodecoder", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/app.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/app.js deleted file mode 100644 index 830070d196d86b127cea947d168bfd116f446205..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/en-US.json b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/zh-CN.json b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.css b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.css deleted file mode 100644 index c9195944a956c0d5628c701b7a3d9d2ed525cd2d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.hml b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 8d0e2061b88c99c91488405f0f2ead0c77de1a9e..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.js deleted file mode 100644 index 67f8b8567ccc4932331b7a18a6b947340d84fb40..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - this.timeout = 60000 - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js deleted file mode 100644 index 4b04c73a09de53e61e7fea1ec8173304dd2be401..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderEnumTest.test.js +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderEnum', function () { - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_ENUM_AACProfile_0100 - * @tc.name : 001.AACProfile - * @tc.desc : Test Enumerate AACProfile - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_ENUM_AACProfile_0100', 0, async function (done) { - expect(media.AACProfile.AAC_PROFILE_LC).assertEqual(0); - expect(media.AACProfile.AAC_PROFILE_ELD).assertEqual(1); - expect(media.AACProfile.AAC_PROFILE_ERLC).assertEqual(2); - expect(media.AACProfile.AAC_PROFILE_HE).assertEqual(3); - expect(media.AACProfile.AAC_PROFILE_HE_V2).assertEqual(4); - expect(media.AACProfile.AAC_PROFILE_LD).assertEqual(5); - expect(media.AACProfile.AAC_PROFILE_MAIN).assertEqual(6); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_ENUM_AudioCaps_0100 - * @tc.name : 002.AudioCaps - * @tc.desc : Test Interface AudioCaps - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_ENUM_AudioCaps_0100', 0, async function (done) { - console.info("case test Test Interface AudioCaps"); - let audioDecodeProcessor; - let audioCaps; - await media.createAudioDecoderByName('avdec_aac').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - audioCaps = AudioCaps; - }, failCallback).catch(failCatch); - // check AudioCaps - expect(audioCaps.codecInfo !== undefined).assertTrue(); - - // check AudioCaps.AVCodecInfo - let avCodecInfo = audioCaps.codecInfo; - expect(avCodecInfo.name !== undefined).assertTrue(); - console.info('avCodecInfo.name: '+ avCodecInfo.name); - expect(avCodecInfo.type !== undefined).assertTrue(); - console.info('avCodecInfo.type: '+ avCodecInfo.type); - expect(avCodecInfo.mimeType !== undefined).assertTrue(); - console.info('avCodecInfo.mimeType: '+ avCodecInfo.mimeType); - expect(avCodecInfo.isHardwareAccelerated !== undefined).assertTrue(); - console.info('avCodecInfo.isHardwareAccelerated: '+ avCodecInfo.isHardwareAccelerated); - expect(avCodecInfo.isSoftwareOnly !== undefined).assertTrue(); - console.info('avCodecInfo.isSoftwareOnly: '+ avCodecInfo.isSoftwareOnly); - expect(avCodecInfo.isVendor !== undefined).assertTrue(); - console.info('avCodecInfo.isVendor: '+ avCodecInfo.isVendor); - - // check AudioCaps.supportedBitrate - expect(audioCaps.supportedBitrate !== undefined).assertTrue(); - console.info('supportedBitrate.min: '+ audioCaps.supportedBitrate.min); - console.info('supportedBitrate.max: '+ audioCaps.supportedBitrate.max); - - // check AudioCaps.supportedChannel - expect(audioCaps.supportedChannel !== undefined).assertTrue(); - console.info('supportedChannel.min: '+ audioCaps.supportedChannel.min); - console.info('supportedChannel.max: '+ audioCaps.supportedChannel.max); - - // check AudioCaps.supportedFormats - expect(audioCaps.supportedFormats !== undefined).assertTrue(); - console.info('audioCaps.supportedFormats: '+ audioCaps.supportedFormats); - - // check AudioCaps.supportedSampleRates - expect(audioCaps.supportedSampleRates !== undefined).assertTrue(); - console.info('audioCaps.supportedSampleRates: '+ audioCaps.supportedSampleRates); - - // check AudioCaps.supportedProfiles - expect(audioCaps.supportedProfiles !== undefined).assertTrue(); - console.info('audioCaps.supportedProfiles: '+ audioCaps.supportedProfiles); - - // check AudioCaps.supportedComplexity - expect(audioCaps.supportedComplexity !== undefined).assertTrue(); - console.info('supportedComplexity.min: '+ audioCaps.supportedComplexity.min); - console.info('supportedComplexity.max: '+ audioCaps.supportedComplexity.max); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_ENUM_AVCodecType_0100 - * @tc.name : 003.AVCodecType - * @tc.desc : Test Enumerate AVCodecType - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_ENUM_AVCodecType_0100', 0, async function (done) { - expect(media.AVCodecType.AVCODEC_TYPE_VIDEO_ENCODER).assertEqual(0); - expect(media.AVCodecType.AVCODEC_TYPE_VIDEO_DECODER).assertEqual(1); - expect(media.AVCodecType.AVCODEC_TYPE_AUDIO_ENCODER).assertEqual(2); - expect(media.AVCodecType.AVCODEC_TYPE_AUDIO_DECODER).assertEqual(3); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_ENUM_CodecMimeType_0100 - * @tc.name : 004.CodecMimeType - * @tc.desc : Test Enumerate CodecMimeType - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_ENUM_CodecMimeType_0100', 0, async function (done) { - expect(media.CodecMimeType.AUDIO_AAC).assertEqual('audio/mp4a-latm'); - expect(media.CodecMimeType.AUDIO_VORBIS).assertEqual('audio/vorbis'); - expect(media.CodecMimeType.AUDIO_FLAC).assertEqual('audio/flac'); - done(); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatCallbackTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatCallbackTest.test.js deleted file mode 100644 index 8f6460db4c7a739aa23e09e2ec770aadbd1a6df6..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatCallbackTest.test.js +++ /dev/null @@ -1,912 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderFormatCallback', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH1 = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const AUDIOPATH2 = RESOURCEPATH + 'FLAC_48000_32_1.flac' - const AUDIOPATH3 = RESOURCEPATH + 'mp3.es'; - const AUDIOPATH4 = RESOURCEPATH + 'vorbis.es'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_format_callback_'; - let audioDecodeProcessor; - let readStreamSync; - let needGetMediaDes = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = []; - let ES_LENGTH = 0; - let samplerate = 44.1; - let isMp3 = false; - let isVorbis = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = null; - readStreamSync = undefined; - needGetMediaDes = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = []; - ES_LENGTH = 0; - samplerate = 44.1; - isMp3 = false; - isVorbis = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.log(e); - } - } - - function readFile(path) { - console.log('read file start execution'); - try{ - console.log('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.log(e); - } - } - - function getContent(buf, len) { - console.log("start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.log('lengthreal: ' + lengthreal); - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - inputobject.timeMs = timestamp; - inputobject.offset = 0; - if (frameCnt==1 && isVorbis) { - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 8; - } else if (isMp3) { - inputobject.length = ES[1]; - getContent(inputobject.data, ES[1]); - inputobject.flags = 0; - } else { - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - } - if (isMp3) { - timestamp += ES[1]/samplerate; - } else { - timestamp += ES[frameCnt]/samplerate; - } - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject, () => { - console.info('queueInput success'); - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.log("stop success"); - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.log("reset success"); - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioDecodeProcessor = null; - done(); - }) - }) - }) - } else { - writeFile(savepath, outputobject.data, outputobject.length); - console.log("write to file success"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject, () => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info("inputBufferAvailable"); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info("outputBufferAvailable"); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - console.log("get OutputMediaDescription success"); - console.log('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }) - } - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0100 - * @tc.name : 001.test aac format(createbymime) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0100', 0, async function (done) { - console.log("case test aac format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'aac_01.pcm'; - needGetMediaDes = true; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338]; - ES_LENGTH = 1000; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH1); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0101 - * @tc.name : 001.test aac format(createbyname) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0101', 0, async function (done) { - console.log("case test aac format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'aac_02.pcm'; - needGetMediaDes = true; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338]; - ES_LENGTH = 1000; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH1); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByName('avdec_aac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0200 - * @tc.name : 002.test flac format(createbymime) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0200', 0, async function (done) { - console.log("case test flac format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'flac_01.pcm'; - needGetMediaDes = true; - samplerate = 48; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, 2806, - 2796,2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, 2839, 2794, - 2770, 2763,2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, 2969, 3240, 3199, - 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, 2779, 2963, 2893, 2870, - 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, 2876, 3223, 3040, 3006, 3042, - 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, 3300, 3140, 3014, 2975, 2952, 2896, - 2897, 2842, 2929, 3567, 3929, 3485, 3082, 3625, 4953, 5239, 5094, 4993, 4821, 4431, - 5195, 5542, 5557, 4894, 4414, 5085, 5496, 5089, 4459, 4532, 4778, 5460, 5372, 5224, - 4395, 4701, 5512, 5304, 4798, 7128, 6534, 5704, 5562, 5539, 5675, 5780, 6058, 6194, - 6076, 5971, 5758, 5202, 4438, 3821, 4267, 5550, 4896, 3841, 5166, 4904, 4504, 5530, - 5354, 5047, 5695, 5422, 5168, 5338, 5154, 5385, 5322, 4934, 4512, 4001, 3793, 3624, - 3589, 3562, 4346, 5407, 5582, 5645, 5581, 5605, 5520, 5399, 5164, 4991, 4556, 4058, - 3662, 3757, 4627, 5183, 5061, 4114, 5840, 5051, 5126, 4573, 5269, 4437, 5021, 5508, - 5289, 5171, 5153, 5118, 5721, 5375, 4863, 6353, 5477, 5608, 5614, 5737, 5178, 4614, - 4671, 5204, 5027, 4977, 3922, 5904]; - ES_LENGTH = 200; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH2); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByMime('audio/flac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0201 - * @tc.name : 002.test flac format(createbyname) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0201', 0, async function (done) { - console.log("case test flac format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'flac_02.pcm'; - needGetMediaDes = true; - samplerate = 48; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, 2806, - 2796,2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, 2839, 2794, - 2770, 2763,2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, 2969, 3240, 3199, - 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, 2779, 2963, 2893, 2870, - 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, 2876, 3223, 3040, 3006, 3042, - 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, 3300, 3140, 3014, 2975, 2952, 2896, - 2897, 2842, 2929, 3567, 3929, 3485, 3082, 3625, 4953, 5239, 5094, 4993, 4821, 4431, - 5195, 5542, 5557, 4894, 4414, 5085, 5496, 5089, 4459, 4532, 4778, 5460, 5372, 5224, - 4395, 4701, 5512, 5304, 4798, 7128, 6534, 5704, 5562, 5539, 5675, 5780, 6058, 6194, - 6076, 5971, 5758, 5202, 4438, 3821, 4267, 5550, 4896, 3841, 5166, 4904, 4504, 5530, - 5354, 5047, 5695, 5422, 5168, 5338, 5154, 5385, 5322, 4934, 4512, 4001, 3793, 3624, - 3589, 3562, 4346, 5407, 5582, 5645, 5581, 5605, 5520, 5399, 5164, 4991, 4556, 4058, - 3662, 3757, 4627, 5183, 5061, 4114, 5840, 5051, 5126, 4573, 5269, 4437, 5021, 5508, - 5289, 5171, 5153, 5118, 5721, 5375, 4863, 6353, 5477, 5608, 5614, 5737, 5178, 4614, - 4671, 5204, 5027, 4977, 3922, 5904]; - ES_LENGTH = 200; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH2); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByName('avdec_flac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0300 - * @tc.name : 003.test mp3 format(createbymime) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0300', 0, async function (done) { - console.log("test mp3 format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'mp3_01.pcm'; - needGetMediaDes = true; - isMp3 = true; - isVorbis = false; - ES = [0, 1044]; - ES_LENGTH = 1000; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH3); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByMime('audio/mpeg', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0301 - * @tc.name : 003.test mp3 format(createbyname) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0301', 0, async function (done) { - console.log("test mp3 format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'mp3_02.pcm'; - needGetMediaDes = true; - isMp3 = true; - isVorbis = false; - ES = [0, 1044]; - ES_LENGTH = 1000; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH3); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByName('avdec_mp3', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0400 - * @tc.name : 004.test vorbis format(createbymime) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0400', 0, async function (done) { - console.log("test vorbis format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'vorbis_01.pcm'; - needGetMediaDes = true; - samplerate = 48; - isVorbis = true; - ES = [0, 3251, 33, 160, 162, 159, 148, 160, 160, 159, 167, 156, 162, 173, 135, 137, 133, - 126, 126, 130, 127, 133, 138, 132, 124, 129, 134, 136, 146, 135, 137, 144, 137, 128, - 124, 127, 129, 127, 130, 127, 134, 130, 135, 146, 142, 140, 134, 134, 128, 119, 122, - 122, 123, 121, 128, 125, 128, 122, 137, 141, 136, 135, 127, 128, 125, 128, 122, 126, - 132, 127, 127, 135, 143, 134, 148, 133, 131, 140, 143, 135, 140, 141, 135, 149, 27, - 30, 36, 32, 157, 155, 158, 154, 136, 150, 149, 142, 150, 142, 149, 139, 142, 146, 138, - 138, 144, 138, 139, 132, 120, 130, 134, 124, 127, 130, 130, 123, 133, 141, 137, 135, - 140, 147, 139, 141, 134, 131, 146, 139, 136, 136, 130, 143, 147, 144, 138, 145, 137, - 137, 138, 142, 148, 149, 138, 141, 148, 139, 139, 139, 134, 135, 131, 124, 131, 131, - 120, 121, 132, 128, 127, 130, 136, 129, 130, 123, 133, 132, 141, 147, 147, 139, 127, - 149, 157, 165, 154, 143, 153, 141, 157, 144, 146, 135, 142, 133, 134, 140, 142, 133, - 136, 133, 141, 143, 128, 127, 136, 144, 138, 141, 133, 127, 123, 138, 131, 126, 130, - 131, 135, 131, 137, 136, 125, 127, 126, 143, 142, 127, 134, 140, 144, 128, 125, 139, - 144, 135, 141, 123, 130, 127, 126, 140, 136, 140, 139, 140, 133, 132, 146, 142, 138, - 134, 130, 125, 130, 130, 129, 137, 133, 128, 130, 130, 132, 135, 126, 129, 142, 129, - 151, 150, 146, 130, 130, 144, 137, 145, 140, 126, 123, 128, 138, 136, 140, 137, 137, - 147, 146, 141, 137, 139, 117, 133, 140, 126, 137, 138, 143, 141, 141, 132, 128, 132, - 145, 148, 151, 160, 162, 154, 140, 147, 30, 28, 28, 26, 27, 27, 31, 33, 32, 145, 132, - 130, 124, 142, 140, 128, 124, 131, 127, 130, 128, 135, 125, 137, 137, 127, 128, 127, - 125, 127, 130, 124, 134, 137, 129, 127, 146, 136, 131, 124, 125, 130, 131, 135, 147, - 148, 151, 147, 143, 148, 145, 158, 142, 137, 129, 127, 156, 147, 143, 137, 135, 142, - 141, 140, 137, 136, 132, 134, 130, 124, 127, 130, 127, 126, 127, 129, 132, 134, 141, - 147, 136, 141, 141, 134, 126, 127, 136, 135, 134, 122, 130, 128, 140, 133, 124, 128, - 137, 128, 141, 135, 141, 147, 153, 151, 151, 154, 150, 147, 157, 153, 153, 153, 151, - 155, 154, 153, 150, 143, 157, 146, 150, 154, 152, 153, 28, 35, 33, 34, 37, 36, 30, 31, - 27, 37, 38, 36, 38, 37, 36, 39, 38, 36, 172, 172, 179, 178, 172, 171, 180, 173, 163, - 164, 159, 159, 155, 163, 184, 187, 176, 176, 184, 179, 174, 167, 165, 166, 160, 166, - 169, 169, 159, 165, 166, 168, 162, 180, 174, 186, 179, 180, 186, 187, 178, 156, 158, - 156, 161, 165, 163, 160, 169, 160, 160, 168, 161, 159, 167, 173, 177, 170, 172, 172, - 169, 157, 161, 155, 165, 164, 154, 161, 160, 31, 30, 28, 31, 31, 29, 38, 36, 40, 31, - 33, 37, 39, 179, 30, 28, 27, 30, 28, 30, 30, 37, 42, 39, 184, 163, 158, 172, 166, 161, - 160, 167, 174, 175, 183, 176, 192, 176, 170, 179, 173, 164, 156, 160, 162, 152, 155, - 157, 174, 176, 184, 173, 180, 177, 182, 190, 170, 167, 154, 156, 171, 169, 172, 177, - 190, 192, 186, 188, 192, 192, 176, 179, 175, 191, 174, 197, 194, 203, 198, 190, 185, - 202, 179, 169, 179, 184, 193, 185, 185, 181, 197, 188, 189, 188, 189, 193, 197, 198, - 203, 188, 189, 198, 190, 196, 191, 191, 197, 202, 182, 178, 186, 194, 192, 186, 187, - 188, 186, 179, 179, 168, 165, 173, 165, 160, 161, 145, 162, 149, 155, 154, 145, 154, - 152, 152, 163, 174, 175, 170, 181, 177, 162, 167, 164, 162, 147, 147, 157, 159, 27, - 28, 28, 36, 36, 37, 35, 35, 35, 35, 37, 37, 35, 35, 36, 171, 40, 40, 176, 178, 171, - 174, 165, 161, 157, 160, 154, 167, 163, 174, 172, 155, 158, 165, 166, 181, 190, 160, - 158, 160, 30, 39, 36, 174, 157, 180, 174, 167, 178, 177, 171, 175, 173, 166, 28, 28, - 28, 29, 30, 34, 35, 36, 29, 36, 37, 38, 32, 29, 41, 38, 38, 35, 34, 34, 36, 34, 35, - 30, 30, 31, 31, 28, 30, 31, 36, 36, 36, 40, 38, 44, 41, 34, 38, 38, 38, 39, 184, 157, - 155, 167, 178]; - ES_LENGTH = 757; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH4); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByMime('audio/vorbis', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0401 - * @tc.name : 004.test vorbis format(createbyname) - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_CALLBACK_01_0401', 0, async function (done) { - console.log("test vorbis format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'vorbis_02.pcm'; - needGetMediaDes = true; - samplerate = 48; - isVorbis = true; - ES = [0, 3251, 33, 160, 162, 159, 148, 160, 160, 159, 167, 156, 162, 173, 135, 137, 133, - 126, 126, 130, 127, 133, 138, 132, 124, 129, 134, 136, 146, 135, 137, 144, 137, 128, - 124, 127, 129, 127, 130, 127, 134, 130, 135, 146, 142, 140, 134, 134, 128, 119, 122, - 122, 123, 121, 128, 125, 128, 122, 137, 141, 136, 135, 127, 128, 125, 128, 122, 126, - 132, 127, 127, 135, 143, 134, 148, 133, 131, 140, 143, 135, 140, 141, 135, 149, 27, - 30, 36, 32, 157, 155, 158, 154, 136, 150, 149, 142, 150, 142, 149, 139, 142, 146, 138, - 138, 144, 138, 139, 132, 120, 130, 134, 124, 127, 130, 130, 123, 133, 141, 137, 135, - 140, 147, 139, 141, 134, 131, 146, 139, 136, 136, 130, 143, 147, 144, 138, 145, 137, - 137, 138, 142, 148, 149, 138, 141, 148, 139, 139, 139, 134, 135, 131, 124, 131, 131, - 120, 121, 132, 128, 127, 130, 136, 129, 130, 123, 133, 132, 141, 147, 147, 139, 127, - 149, 157, 165, 154, 143, 153, 141, 157, 144, 146, 135, 142, 133, 134, 140, 142, 133, - 136, 133, 141, 143, 128, 127, 136, 144, 138, 141, 133, 127, 123, 138, 131, 126, 130, - 131, 135, 131, 137, 136, 125, 127, 126, 143, 142, 127, 134, 140, 144, 128, 125, 139, - 144, 135, 141, 123, 130, 127, 126, 140, 136, 140, 139, 140, 133, 132, 146, 142, 138, - 134, 130, 125, 130, 130, 129, 137, 133, 128, 130, 130, 132, 135, 126, 129, 142, 129, - 151, 150, 146, 130, 130, 144, 137, 145, 140, 126, 123, 128, 138, 136, 140, 137, 137, - 147, 146, 141, 137, 139, 117, 133, 140, 126, 137, 138, 143, 141, 141, 132, 128, 132, - 145, 148, 151, 160, 162, 154, 140, 147, 30, 28, 28, 26, 27, 27, 31, 33, 32, 145, 132, - 130, 124, 142, 140, 128, 124, 131, 127, 130, 128, 135, 125, 137, 137, 127, 128, 127, - 125, 127, 130, 124, 134, 137, 129, 127, 146, 136, 131, 124, 125, 130, 131, 135, 147, - 148, 151, 147, 143, 148, 145, 158, 142, 137, 129, 127, 156, 147, 143, 137, 135, 142, - 141, 140, 137, 136, 132, 134, 130, 124, 127, 130, 127, 126, 127, 129, 132, 134, 141, - 147, 136, 141, 141, 134, 126, 127, 136, 135, 134, 122, 130, 128, 140, 133, 124, 128, - 137, 128, 141, 135, 141, 147, 153, 151, 151, 154, 150, 147, 157, 153, 153, 153, 151, - 155, 154, 153, 150, 143, 157, 146, 150, 154, 152, 153, 28, 35, 33, 34, 37, 36, 30, 31, - 27, 37, 38, 36, 38, 37, 36, 39, 38, 36, 172, 172, 179, 178, 172, 171, 180, 173, 163, - 164, 159, 159, 155, 163, 184, 187, 176, 176, 184, 179, 174, 167, 165, 166, 160, 166, - 169, 169, 159, 165, 166, 168, 162, 180, 174, 186, 179, 180, 186, 187, 178, 156, 158, - 156, 161, 165, 163, 160, 169, 160, 160, 168, 161, 159, 167, 173, 177, 170, 172, 172, - 169, 157, 161, 155, 165, 164, 154, 161, 160, 31, 30, 28, 31, 31, 29, 38, 36, 40, 31, - 33, 37, 39, 179, 30, 28, 27, 30, 28, 30, 30, 37, 42, 39, 184, 163, 158, 172, 166, 161, - 160, 167, 174, 175, 183, 176, 192, 176, 170, 179, 173, 164, 156, 160, 162, 152, 155, - 157, 174, 176, 184, 173, 180, 177, 182, 190, 170, 167, 154, 156, 171, 169, 172, 177, - 190, 192, 186, 188, 192, 192, 176, 179, 175, 191, 174, 197, 194, 203, 198, 190, 185, - 202, 179, 169, 179, 184, 193, 185, 185, 181, 197, 188, 189, 188, 189, 193, 197, 198, - 203, 188, 189, 198, 190, 196, 191, 191, 197, 202, 182, 178, 186, 194, 192, 186, 187, - 188, 186, 179, 179, 168, 165, 173, 165, 160, 161, 145, 162, 149, 155, 154, 145, 154, - 152, 152, 163, 174, 175, 170, 181, 177, 162, 167, 164, 162, 147, 147, 157, 159, 27, - 28, 28, 36, 36, 37, 35, 35, 35, 35, 37, 37, 35, 35, 36, 171, 40, 40, 176, 178, 171, - 174, 165, 161, 157, 160, 154, 167, 163, 174, 172, 155, 158, 165, 166, 181, 190, 160, - 158, 160, 30, 39, 36, 174, 157, 180, 174, 167, 178, 177, 171, 175, 173, 166, 28, 28, - 28, 29, 30, 34, 35, 36, 29, 36, 37, 38, 32, 29, 41, 38, 38, 35, 34, 34, 36, 34, 35, - 30, 30, 31, 31, 28, 30, 31, 36, 36, 36, 40, 38, 44, 41, 34, 38, 38, 38, 39, 184, 157, - 155, 167, 178]; - ES_LENGTH = 757; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.log("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH4); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByName('avdec_vorbis', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatPromiseTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatPromiseTest.test.js deleted file mode 100644 index 1435aa48de9aa6e03773375612121610e39d038a..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFormatPromiseTest.test.js +++ /dev/null @@ -1,767 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderFormatPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH1 = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const AUDIOPATH2 = RESOURCEPATH + 'FLAC_48000_32_1.flac' - const AUDIOPATH3 = RESOURCEPATH + 'mp3.es'; - const AUDIOPATH4 = RESOURCEPATH + 'vorbis.es'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_format_promise_'; - let audioDecodeProcessor; - let readStreamSync; - let needGetMediaDes = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = []; - let ES_LENGTH = 0; - let samplerate = 44.1; - let isMp3 = false; - let isVorbis = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = null; - readStreamSync = undefined; - needGetMediaDes = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = []; - ES_LENGTH = 0; - samplerate = 44.1; - isMp3 = false; - isVorbis = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.log(e) - } - } - - function readFile(path) { - console.log('read file start execution'); - try{ - console.log('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.log(e); - } - } - - function getContent(buf, len) { - console.log("start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.log('lengthreal: ' + lengthreal); - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - inputobject.timeMs = timestamp; - inputobject.offset = 0; - if (frameCnt==1 && isVorbis) { - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 8; - } else if (isMp3) { - inputobject.length = ES[1]; - getContent(inputobject.data, ES[1]); - inputobject.flags = 0; - } else { - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - } - if (isMp3) { - timestamp += ES[1]/samplerate; - } else { - timestamp += ES[frameCnt]/samplerate; - } - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject).then(() => { - console.info("queueInput success") - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - await audioDecodeProcessor.stop().then(() => { - console.log("stop success"); - }, failCallback).catch(failCatch); - inputQueue = []; - outputQueue = []; - await audioDecodeProcessor.reset().then(() => { - console.log("reset success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.release().then(() => { - console.info('release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - done(); - } - else{ - writeFile(savepath, outputobject.data, outputobject.length); - console.log("write to file success"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info("inputBufferAvailable"); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info("outputBufferAvailable"); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.log("get OutputMediaDescription success"); - console.log('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }, failCallback).catch(failCatch);} - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0100 - * @tc.name : 001.test aac format(createbymime) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0100', 0, async function (done) { - console.log("case test aac format"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'aac_01.pcm'; - needGetMediaDes = true; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338]; - ES_LENGTH = 1000; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH1); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0101 - * @tc.name : 001.test aac format(createbyname) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0101', 0, async function (done) { - console.log("case test aac format"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'aac_02.pcm'; - needGetMediaDes = true; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338]; - ES_LENGTH = 1000; - await media.createAudioDecoderByName('avdec_aac').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH1); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0200 - * @tc.name : 002.test flac format(createbymime) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0200', 0, async function (done) { - console.log("case test flac format"); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'flac_01.pcm'; - needGetMediaDes = true; - samplerate = 48; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, 2806, - 2796,2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, 2839, 2794, - 2770, 2763,2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, 2969, 3240, 3199, - 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, 2779, 2963, 2893, 2870, - 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, 2876, 3223, 3040, 3006, 3042, - 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, 3300, 3140, 3014, 2975, 2952, 2896, - 2897, 2842, 2929, 3567, 3929, 3485, 3082, 3625, 4953, 5239, 5094, 4993, 4821, 4431, - 5195, 5542, 5557, 4894, 4414, 5085, 5496, 5089, 4459, 4532, 4778, 5460, 5372, 5224, - 4395, 4701, 5512, 5304, 4798, 7128, 6534, 5704, 5562, 5539, 5675, 5780, 6058, 6194, - 6076, 5971, 5758, 5202, 4438, 3821, 4267, 5550, 4896, 3841, 5166, 4904, 4504, 5530, - 5354, 5047, 5695, 5422, 5168, 5338, 5154, 5385, 5322, 4934, 4512, 4001, 3793, 3624, - 3589, 3562, 4346, 5407, 5582, 5645, 5581, 5605, 5520, 5399, 5164, 4991, 4556, 4058, - 3662, 3757, 4627, 5183, 5061, 4114, 5840, 5051, 5126, 4573, 5269, 4437, 5021, 5508, - 5289, 5171, 5153, 5118, 5721, 5375, 4863, 6353, 5477, 5608, 5614, 5737, 5178, 4614, - 4671, 5204, 5027, 4977, 3922, 5904]; - ES_LENGTH = 200; - await media.createAudioDecoderByMime('audio/flac').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - console.log("start configure"); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH2); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0201 - * @tc.name : 002.test flac format(createbyname) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0201', 0, async function (done) { - console.log("case test flac format"); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'flac_02.pcm'; - needGetMediaDes = true; - samplerate = 48; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, 2806, - 2796,2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, 2839, 2794, - 2770, 2763,2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, 2969, 3240, 3199, - 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, 2779, 2963, 2893, 2870, - 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, 2876, 3223, 3040, 3006, 3042, - 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, 3300, 3140, 3014, 2975, 2952, 2896, - 2897, 2842, 2929, 3567, 3929, 3485, 3082, 3625, 4953, 5239, 5094, 4993, 4821, 4431, - 5195, 5542, 5557, 4894, 4414, 5085, 5496, 5089, 4459, 4532, 4778, 5460, 5372, 5224, - 4395, 4701, 5512, 5304, 4798, 7128, 6534, 5704, 5562, 5539, 5675, 5780, 6058, 6194, - 6076, 5971, 5758, 5202, 4438, 3821, 4267, 5550, 4896, 3841, 5166, 4904, 4504, 5530, - 5354, 5047, 5695, 5422, 5168, 5338, 5154, 5385, 5322, 4934, 4512, 4001, 3793, 3624, - 3589, 3562, 4346, 5407, 5582, 5645, 5581, 5605, 5520, 5399, 5164, 4991, 4556, 4058, - 3662, 3757, 4627, 5183, 5061, 4114, 5840, 5051, 5126, 4573, 5269, 4437, 5021, 5508, - 5289, 5171, 5153, 5118, 5721, 5375, 4863, 6353, 5477, 5608, 5614, 5737, 5178, 4614, - 4671, 5204, 5027, 4977, 3922, 5904]; - ES_LENGTH = 200; - await media.createAudioDecoderByName('avdec_flac').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - console.log("start configure"); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH2); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0300 - * @tc.name : 003.test mp3 format(createbymime) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0300', 0, async function (done) { - console.log("case test mp3 format"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'mp3_01.pcm'; - needGetMediaDes = true; - isMp3 = true; - ES = [0, 1044]; - ES_LENGTH = 1000; - await media.createAudioDecoderByMime('audio/mpeg').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH3); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0301 - * @tc.name : 003.test mp3 format(createbyname) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0301', 0, async function (done) { - console.log("case test mp3 format"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'mp3_02.pcm'; - needGetMediaDes = true; - isMp3 = true; - ES = [0, 1044]; - ES_LENGTH = 1000; - await media.createAudioDecoderByName('avdec_mp3').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH3); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0400 - * @tc.name : 004.test vorbis format(createbymime) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0400', 0, async function (done) { - console.log("case test vorbis format"); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'vorbis_01.pcm'; - needGetMediaDes = true; - samplerate = 48; - isVorbis = true; - ES = [0, 3251, 33, 160, 162, 159, 148, 160, 160, 159, 167, 156, 162, 173, 135, 137, 133, - 126, 126, 130, 127, 133, 138, 132, 124, 129, 134, 136, 146, 135, 137, 144, 137, 128, - 124, 127, 129, 127, 130, 127, 134, 130, 135, 146, 142, 140, 134, 134, 128, 119, 122, - 122, 123, 121, 128, 125, 128, 122, 137, 141, 136, 135, 127, 128, 125, 128, 122, 126, - 132, 127, 127, 135, 143, 134, 148, 133, 131, 140, 143, 135, 140, 141, 135, 149, 27, - 30, 36, 32, 157, 155, 158, 154, 136, 150, 149, 142, 150, 142, 149, 139, 142, 146, 138, - 138, 144, 138, 139, 132, 120, 130, 134, 124, 127, 130, 130, 123, 133, 141, 137, 135, - 140, 147, 139, 141, 134, 131, 146, 139, 136, 136, 130, 143, 147, 144, 138, 145, 137, - 137, 138, 142, 148, 149, 138, 141, 148, 139, 139, 139, 134, 135, 131, 124, 131, 131, - 120, 121, 132, 128, 127, 130, 136, 129, 130, 123, 133, 132, 141, 147, 147, 139, 127, - 149, 157, 165, 154, 143, 153, 141, 157, 144, 146, 135, 142, 133, 134, 140, 142, 133, - 136, 133, 141, 143, 128, 127, 136, 144, 138, 141, 133, 127, 123, 138, 131, 126, 130, - 131, 135, 131, 137, 136, 125, 127, 126, 143, 142, 127, 134, 140, 144, 128, 125, 139, - 144, 135, 141, 123, 130, 127, 126, 140, 136, 140, 139, 140, 133, 132, 146, 142, 138, - 134, 130, 125, 130, 130, 129, 137, 133, 128, 130, 130, 132, 135, 126, 129, 142, 129, - 151, 150, 146, 130, 130, 144, 137, 145, 140, 126, 123, 128, 138, 136, 140, 137, 137, - 147, 146, 141, 137, 139, 117, 133, 140, 126, 137, 138, 143, 141, 141, 132, 128, 132, - 145, 148, 151, 160, 162, 154, 140, 147, 30, 28, 28, 26, 27, 27, 31, 33, 32, 145, 132, - 130, 124, 142, 140, 128, 124, 131, 127, 130, 128, 135, 125, 137, 137, 127, 128, 127, - 125, 127, 130, 124, 134, 137, 129, 127, 146, 136, 131, 124, 125, 130, 131, 135, 147, - 148, 151, 147, 143, 148, 145, 158, 142, 137, 129, 127, 156, 147, 143, 137, 135, 142, - 141, 140, 137, 136, 132, 134, 130, 124, 127, 130, 127, 126, 127, 129, 132, 134, 141, - 147, 136, 141, 141, 134, 126, 127, 136, 135, 134, 122, 130, 128, 140, 133, 124, 128, - 137, 128, 141, 135, 141, 147, 153, 151, 151, 154, 150, 147, 157, 153, 153, 153, 151, - 155, 154, 153, 150, 143, 157, 146, 150, 154, 152, 153, 28, 35, 33, 34, 37, 36, 30, 31, - 27, 37, 38, 36, 38, 37, 36, 39, 38, 36, 172, 172, 179, 178, 172, 171, 180, 173, 163, - 164, 159, 159, 155, 163, 184, 187, 176, 176, 184, 179, 174, 167, 165, 166, 160, 166, - 169, 169, 159, 165, 166, 168, 162, 180, 174, 186, 179, 180, 186, 187, 178, 156, 158, - 156, 161, 165, 163, 160, 169, 160, 160, 168, 161, 159, 167, 173, 177, 170, 172, 172, - 169, 157, 161, 155, 165, 164, 154, 161, 160, 31, 30, 28, 31, 31, 29, 38, 36, 40, 31, - 33, 37, 39, 179, 30, 28, 27, 30, 28, 30, 30, 37, 42, 39, 184, 163, 158, 172, 166, 161, - 160, 167, 174, 175, 183, 176, 192, 176, 170, 179, 173, 164, 156, 160, 162, 152, 155, - 157, 174, 176, 184, 173, 180, 177, 182, 190, 170, 167, 154, 156, 171, 169, 172, 177, - 190, 192, 186, 188, 192, 192, 176, 179, 175, 191, 174, 197, 194, 203, 198, 190, 185, - 202, 179, 169, 179, 184, 193, 185, 185, 181, 197, 188, 189, 188, 189, 193, 197, 198, - 203, 188, 189, 198, 190, 196, 191, 191, 197, 202, 182, 178, 186, 194, 192, 186, 187, - 188, 186, 179, 179, 168, 165, 173, 165, 160, 161, 145, 162, 149, 155, 154, 145, 154, - 152, 152, 163, 174, 175, 170, 181, 177, 162, 167, 164, 162, 147, 147, 157, 159, 27, - 28, 28, 36, 36, 37, 35, 35, 35, 35, 37, 37, 35, 35, 36, 171, 40, 40, 176, 178, 171, - 174, 165, 161, 157, 160, 154, 167, 163, 174, 172, 155, 158, 165, 166, 181, 190, 160, - 158, 160, 30, 39, 36, 174, 157, 180, 174, 167, 178, 177, 171, 175, 173, 166, 28, 28, - 28, 29, 30, 34, 35, 36, 29, 36, 37, 38, 32, 29, 41, 38, 38, 35, 34, 34, 36, 34, 35, - 30, 30, 31, 31, 28, 30, 31, 36, 36, 36, 40, 38, 44, 41, 34, 38, 38, 38, 39, 184, 157, - 155, 167, 178]; - ES_LENGTH = 757; - await media.createAudioDecoderByMime('audio/vorbis').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH4); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0401 - * @tc.name : 004.test vorbis format(createbyname) - * @tc.desc : decode format test - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FORMAT_PROMISE_01_0401', 0, async function (done) { - console.log("case test vorbis format"); - let mediaDescription = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + 'vorbis_02.pcm'; - needGetMediaDes = true; - samplerate = 48; - isVorbis = true; - ES = [0, 3251, 33, 160, 162, 159, 148, 160, 160, 159, 167, 156, 162, 173, 135, 137, 133, - 126, 126, 130, 127, 133, 138, 132, 124, 129, 134, 136, 146, 135, 137, 144, 137, 128, - 124, 127, 129, 127, 130, 127, 134, 130, 135, 146, 142, 140, 134, 134, 128, 119, 122, - 122, 123, 121, 128, 125, 128, 122, 137, 141, 136, 135, 127, 128, 125, 128, 122, 126, - 132, 127, 127, 135, 143, 134, 148, 133, 131, 140, 143, 135, 140, 141, 135, 149, 27, - 30, 36, 32, 157, 155, 158, 154, 136, 150, 149, 142, 150, 142, 149, 139, 142, 146, 138, - 138, 144, 138, 139, 132, 120, 130, 134, 124, 127, 130, 130, 123, 133, 141, 137, 135, - 140, 147, 139, 141, 134, 131, 146, 139, 136, 136, 130, 143, 147, 144, 138, 145, 137, - 137, 138, 142, 148, 149, 138, 141, 148, 139, 139, 139, 134, 135, 131, 124, 131, 131, - 120, 121, 132, 128, 127, 130, 136, 129, 130, 123, 133, 132, 141, 147, 147, 139, 127, - 149, 157, 165, 154, 143, 153, 141, 157, 144, 146, 135, 142, 133, 134, 140, 142, 133, - 136, 133, 141, 143, 128, 127, 136, 144, 138, 141, 133, 127, 123, 138, 131, 126, 130, - 131, 135, 131, 137, 136, 125, 127, 126, 143, 142, 127, 134, 140, 144, 128, 125, 139, - 144, 135, 141, 123, 130, 127, 126, 140, 136, 140, 139, 140, 133, 132, 146, 142, 138, - 134, 130, 125, 130, 130, 129, 137, 133, 128, 130, 130, 132, 135, 126, 129, 142, 129, - 151, 150, 146, 130, 130, 144, 137, 145, 140, 126, 123, 128, 138, 136, 140, 137, 137, - 147, 146, 141, 137, 139, 117, 133, 140, 126, 137, 138, 143, 141, 141, 132, 128, 132, - 145, 148, 151, 160, 162, 154, 140, 147, 30, 28, 28, 26, 27, 27, 31, 33, 32, 145, 132, - 130, 124, 142, 140, 128, 124, 131, 127, 130, 128, 135, 125, 137, 137, 127, 128, 127, - 125, 127, 130, 124, 134, 137, 129, 127, 146, 136, 131, 124, 125, 130, 131, 135, 147, - 148, 151, 147, 143, 148, 145, 158, 142, 137, 129, 127, 156, 147, 143, 137, 135, 142, - 141, 140, 137, 136, 132, 134, 130, 124, 127, 130, 127, 126, 127, 129, 132, 134, 141, - 147, 136, 141, 141, 134, 126, 127, 136, 135, 134, 122, 130, 128, 140, 133, 124, 128, - 137, 128, 141, 135, 141, 147, 153, 151, 151, 154, 150, 147, 157, 153, 153, 153, 151, - 155, 154, 153, 150, 143, 157, 146, 150, 154, 152, 153, 28, 35, 33, 34, 37, 36, 30, 31, - 27, 37, 38, 36, 38, 37, 36, 39, 38, 36, 172, 172, 179, 178, 172, 171, 180, 173, 163, - 164, 159, 159, 155, 163, 184, 187, 176, 176, 184, 179, 174, 167, 165, 166, 160, 166, - 169, 169, 159, 165, 166, 168, 162, 180, 174, 186, 179, 180, 186, 187, 178, 156, 158, - 156, 161, 165, 163, 160, 169, 160, 160, 168, 161, 159, 167, 173, 177, 170, 172, 172, - 169, 157, 161, 155, 165, 164, 154, 161, 160, 31, 30, 28, 31, 31, 29, 38, 36, 40, 31, - 33, 37, 39, 179, 30, 28, 27, 30, 28, 30, 30, 37, 42, 39, 184, 163, 158, 172, 166, 161, - 160, 167, 174, 175, 183, 176, 192, 176, 170, 179, 173, 164, 156, 160, 162, 152, 155, - 157, 174, 176, 184, 173, 180, 177, 182, 190, 170, 167, 154, 156, 171, 169, 172, 177, - 190, 192, 186, 188, 192, 192, 176, 179, 175, 191, 174, 197, 194, 203, 198, 190, 185, - 202, 179, 169, 179, 184, 193, 185, 185, 181, 197, 188, 189, 188, 189, 193, 197, 198, - 203, 188, 189, 198, 190, 196, 191, 191, 197, 202, 182, 178, 186, 194, 192, 186, 187, - 188, 186, 179, 179, 168, 165, 173, 165, 160, 161, 145, 162, 149, 155, 154, 145, 154, - 152, 152, 163, 174, 175, 170, 181, 177, 162, 167, 164, 162, 147, 147, 157, 159, 27, - 28, 28, 36, 36, 37, 35, 35, 35, 35, 37, 37, 35, 35, 36, 171, 40, 40, 176, 178, 171, - 174, 165, 161, 157, 160, 154, 167, 163, 174, 172, 155, 158, 165, 166, 181, 190, 160, - 158, 160, 30, 39, 36, 174, 157, 180, 174, 167, 178, 177, 171, 175, 173, 166, 28, 28, - 28, 29, 30, 34, 35, 36, 29, 36, 37, 38, 32, 29, 41, 38, 38, 35, 34, 34, 36, 34, 35, - 30, 30, 31, 31, 28, 30, 31, 36, 36, 36, 40, 38, 44, 41, 34, 38, 38, 38, 39, 184, 157, - 155, 167, 178]; - ES_LENGTH = 757; - await media.createAudioDecoderByName('avdec_vorbis').then((processor) => { - console.log("create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.log("get AudioDecoderCaps success"); - console.log("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.log("configure success"); - readFile(AUDIOPATH4); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.log("prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.log("start success"); - }, failCallback).catch(failCatch); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js deleted file mode 100644 index 926ac674e426507d78dda9c0c8f63859fd209bad..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js +++ /dev/null @@ -1,1084 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderFuncCallback', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const AUDIOPATH2 = RESOURCEPATH + 'AAC_16000_1.aac'; - const AUDIOPATH3 = RESOURCEPATH + 'FLAC_48000_32_1.flac'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_func_callback_'; - let audioDecodeProcessor; - let readStreamSync; - let eosframenum = 0; - let samplerate = 44.1; - let workdoneAtEOS = false; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let needGetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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]; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = null; - readStreamSync = undefined; - eosframenum = 0; - samplerate = 44.1; - workdoneAtEOS = false; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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 = 1500; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function resetParam(){ - readStreamSync = undefined; - eosframenum = 0; - samplerate = 44.1; - workdoneAtEOS = false; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeFile(path, buf, len){ - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - }catch(e){ - console.info(e) - } - } - - function readFile(path){ - console.info('read file start execution'); - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - }catch(e){ - console.info(e); - } - } - - function getContent(buf, len){ - console.info("start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - async function stopWork() { - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success") - }) - } - - async function resetWork() { - resetParam(); - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info("case reset success"); - if (needrelease) { - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioDecodeProcessor = null; - }) - } - }) - } - - async function flushWork() { - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }) - } - - async function doneWork(done) { - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success"); - resetParam(); - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.log("case reset success"); - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioDecodeProcessor = null; - done(); - }) - }) - }) - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function enqueueAllInputs(queue){ - while (queue.length > 0 && !sawInputEOS){ - let inputobject = queue.shift(); - console.info("frameCnt:" + frameCnt); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1){ - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } - else{ - console.info("read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - timestamp += ES[frameCnt]/samplerate; - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject, () => { - console.info('queueInput success'); - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (stopAtEOS) { - await stopWork(); - } else if (resetAtEOS) { - await resetWork(); - } else if (flushAtEOS) { - await flushWork(); - } else if (workdoneAtEOS) { - await doneWork(done); - } else { - console.info("saw output EOS"); - } - } - else{ - writeFile(savepath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject, () => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needGetMediaDes){ - audioDecodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - expect(err).assertUndefined(); - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }); - } - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_00_0100 - * @tc.name : 000.test set EOS after last frame and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) { - console.info("case test set EOS after last frame and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - workdoneAtEOS = true; - needGetMediaDes = true; - let savepath = BASIC_PATH + '0000.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - eventEmitter.on('createAudioDecoder', () => { - media.createAudioDecoderByName('avdec_aac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }); - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getAudioDecoderCaps((err, audioCapsArray) => { - expect(err).assertUndefined(); - console.info('getAudioDecoderCaps success'); - if (typeof (audioCapsArray) != 'undefined') { - console.info('get first audioCaps'+ audioCapsArray[0]); - console.info('codecInfo: '+ audioCapsArray[0].codecInfo); - console.info('supportedBitrate: '+ audioCapsArray[0].supportedBitrate); - console.info('supportedBitrate.min: '+ audioCapsArray[0].supportedBitrate.min); - } else { - console.info('audioCaps is not defined'); - } - }) - } else { - console.info('mediaCaps is not defined'); - } - eventEmitter.emit('createAudioDecoder'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0100 - * @tc.name : 001.test set EOS manually before last frame and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { - console.info("case test set EOS manually before last frame and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - eosframenum = 500; - workdoneAtEOS = true; - let savepath = BASIC_PATH + '0100.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info(`case getMediaCapability 1`); - mediaCaps.getAudioDecoderCaps((err, audioCaps) => { - expect(err).assertUndefined(); - console.info('getAudioDecoderCaps success'); - if (typeof (audioCaps) != 'undefined') { - console.info("case audioCaps " + audioCaps); - } else { - console.info("case audioCaps is not defined"); - } - }) - }) - media.createAudioDecoderByName('avdec_aac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0200 - * @tc.name : 002.test flush at running state - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { - console.info("case test flush at running state"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - workdoneAtEOS = true; - let savepath = BASIC_PATH + '0200.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - setTimeout(() => {eventEmitter.emit('flush')},2000) - }) - }); - eventEmitter.on('flush', () => { - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info(`case flush after 2s`); - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0300 - * @tc.name : 003. test flush at EOS state - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { - console.info("case test flush at EOS state"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - eosframenum = 200; - flushAtEOS = true; - let savepath = BASIC_PATH + '0300.pcm'; - - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0400 - * @tc.name : 004. test stop at running state and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { - console.info("case test stop at running state and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0400.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - eventEmitter.emit('stop'); - }) - }); - eventEmitter.on('stop', () => { - sleep(5000).then(() => { - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`case stop 1`); - eventEmitter.emit('reset'); - }) - }) - }); - eventEmitter.on('reset', () => { - resetParam(); - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info(`case reset 1`); - eventEmitter.emit('release'); - }) - }); - eventEmitter.on('release', () => { - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info(`case release 1`); - audioDecodeProcessor = null; - done(); - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0500 - * @tc.name : 005. test stop and restart - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { - console.info("case test start - stop - restart"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - eosframenum = 200; - let savepath = BASIC_PATH + '0500.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - eventEmitter.emit('stop'); - }) - }); - eventEmitter.on('stop', () => { - sleep(5000).then(() => { - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`stop after 5s`); - resetParam(); - readFile(AUDIOPATH); - eventEmitter.emit('restart'); - }) - }) - }); - eventEmitter.on('restart', () => { - sleep(2000).then(() => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`restart after 2s`); - workdoneAtEOS=true; - enqueueAllInputs(inputQueue); - }) - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0600 - * @tc.name : 006. test reconfigure for new file with the same format - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0600', 0, async function (done) { - console.info("case test reconfigure codec for new file with the same format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - eosframenum = 200; - resetAtEOS = true; - let savepath = BASIC_PATH + '0600.pcm'; - let mediaDescription2 = { - "channel_count": 1, - "sample_rate": 16000, - "audio_sample_format": 1, - } - let hasreconfigured = false; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - if (!hasreconfigured){ - eventEmitter.emit('reconfigure', mediaDescription2); - } - }) - }); - eventEmitter.on('reconfigure', (mediaDescription2) => { - sleep(10000).then(() => { - audioDecodeProcessor.configure(mediaDescription2, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 2`); - resetParam(); - console.info('resetParam success, resetAtEOS IS :' + resetAtEOS) - readFile(AUDIOPATH2) - savepath = BASIC_PATH + '0601.pcm'; - workdoneAtEOS = true; - ES = [0, 239, 302, 309, 330, 474, 684, 699, 683, 674, 647, 649, 638, 644, 640, - 639, 650, 702, 713, 718, 707, 707, 683, 670, 674, 699, 654, 650, 715, 770, - 764, 736, 697, 664, 643, 649, 704, 730, 720, 710, 689, 670, 673, 653, 635, - 643, 638, 653, 658, 683, 683, 705, 690, 681, 648, 659, 743, 681, 706, 707, - 718, 714, 746, 725, 741, 709, 675, 675, 751, 698, 736, 738, 711, 702, 691, - 668, 668, 650, 661, 678, 694, 719, 685, 700, 657, 671, 668, 701, 689, 685, - 682, 668, 696, 690, 683, 739, 704, 667, 694, 716, 757, 714, 701, 664, 619, - 609, 591, 644, 573, 572, 605, 595, 597, 529, 581, 578, 586, 537, 577, 535, - 572, 570, 534, 547, 581, 530, 591, 521, 556, 570, 557, 541, 506, 572, 579, - 502, 516, 582, 540, 584, 548, 555, 539, 578, 588, 541, 539, 526, 575, 535, - 571, 525, 569, 560, 584, 551, 574, 572, 537, 550, 582, 512, 559, 593, 601, - 594, 546, 560, 567, 547, 529, 576, 577, 556, 551, 530, 542, 575, 510, 559, - 613, 628, 511, 566, 515, 539, 594, 536, 565, 551, 533, 613, 557, 523, 574, - 582, 616, 610, 573, 509, 535]; - ES_LENGTH = 200; - samplerate = 16; - hasreconfigured = true; - eventEmitter.emit('prepare'); - }) - }) - }); - media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0700 - * @tc.name : 007. test reconfigure for new file with different formats - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_CALLBACK_01_0700', 0, async function (done) { - console.info("case test reconfigure codec for new file with different format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let mediaDescription2 = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let hasrecreate = false; - eosframenum = 200; - resetAtEOS = true; - needrelease = true; - let savepath = BASIC_PATH + '0700.pcm'; - eventEmitter.on('getAudioDecoderCaps', () => { - audioDecodeProcessor.getAudioDecoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioDecoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - if (!hasrecreate){ - eventEmitter.emit('recreate'); - } - }) - }); - eventEmitter.on('recreate', () => { - sleep(10000).then(() => { - media.createAudioDecoderByMime('audio/flac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder flac`); - audioDecodeProcessor = processor; - hasrecreate = true; - eventEmitter.emit('reconfigure', mediaDescription2); - }) - }) - }); - eventEmitter.on('reconfigure', (mediaDescription2) => { - audioDecodeProcessor.configure(mediaDescription2, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 2`); - resetParam(); - readFile(AUDIOPATH3) - savepath = BASIC_PATH + '0701.pcm'; - workdoneAtEOS = true; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, - 2806, 2796, 2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, - 2839, 2794, 2770, 2763, 2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, - 2969, 3240, 3199, 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, - 2779, 2963, 2893, 2870, 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, - 2876, 3223, 3040, 3006, 3042, 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, - 3300, 3140, 3014, 2975, 2952, 2896, 2897, 2842, 2929, 3567, 3929, 3485, 3082, - 3625, 4953, 5239, 5094, 4993, 4821, 4431, 5195, 5542, 5557, 4894, 4414]; - ES_LENGTH = 100; - samplerate = 48; - eventEmitter.emit('prepare'); - }) - }); - media.createAudioDecoderByName('avdec_aac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - eventEmitter.emit('getAudioDecoderCaps'); - }) - }) -}) - diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncPromiseTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncPromiseTest.test.js deleted file mode 100644 index e2b4045b6f1d8b1c74284efdef1133271d702d32..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncPromiseTest.test.js +++ /dev/null @@ -1,883 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderFuncPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const AUDIOPATH2 = RESOURCEPATH + 'AAC_16000_1.aac'; - const AUDIOPATH3 = RESOURCEPATH + 'FLAC_48000_32_1.flac'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_func_promise_'; - let audioDecodeProcessor; - let readStreamSync; - let eosframenum = 0; - let samplerate = 44.1; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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]; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = undefined; - readStreamSync = undefined; - eosframenum = 0; - samplerate = 44.1; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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 = 1500; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function resetParam() { - readStreamSync = undefined; - eosframenum = 0; - samplerate = 44.1; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - }catch(e) { - console.info(e) - } - } - - function readFile(path) { - console.info('read file start execution'); - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - }catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - } - - async function stopWork() { - await audioDecodeProcessor.stop().then(() => { - console.info("case stop success") - }, failCallback).catch(failCatch); - } - - async function resetWork() { - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - if (needrelease) { - audioDecodeProcessor = null; - } - }, failCallback).catch(failCatch); - } - - async function flushWork() { - inputQueue = []; - outputQueue = []; - await audioDecodeProcessor.flush().then(() => { - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }, failCallback).catch(failCatch); - } - - async function doneWork() { - await audioDecodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioDecodeProcessor = null; - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - timestamp += ES[frameCnt]/samplerate; - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueAllOutputs(queue, savapath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - console.info("sawOutputEOS == true"); - if (stopAtEOS) { - await stopWork(); - } else if (resetAtEOS) { - await resetWork(); - } else if (flushAtEOS) { - await flushWork(); - } else if (workdoneAtEOS) { - await doneWork(); - done(); - } else { - console.info("saw output EOS"); - } - } - else{ - writeFile(savapath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - console.info("outputbuffer.flags: " + outBuffer.flags); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }, failCallback).catch(failCatch);} - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_00_0100 - * @tc.name : 000.test set EOS after last frame and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_00_0100', 0, async function (done) { - console.info("case test set EOS after last frame and reset"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0000.pcm'; - workdoneAtEOS = true; - needGetMediaDes = true; - await media.getMediaCapability().then((mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getAudioDecoderCaps().then((audioCapsArray) => { - console.info('getAudioDecoderCaps success'); - if (typeof (audioCapsArray) != 'undefined') { - console.info('audioCapsArray is not null'); - console.info('get first audioCaps'+ audioCapsArray[0]); - console.info('codecInfo: '+ audioCapsArray[0].codecInfo); - console.info('supportedBitrate: '+ audioCapsArray[0].supportedBitrate); - console.info('supportedBitrate.min: '+ audioCapsArray[0].supportedBitrate.min); - } else { - console.info('audioCaps is not defined'); - } - }, failCallback).catch(failCatch); - } else { - console.info('mediaCaps is not defined'); - } - }, failCallback).catch(failCatch); - await media.createAudioDecoderByName('avdec_aac').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0100 - * @tc.name : 001.test set EOS manually before last frame and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0100', 0, async function (done) { - console.info("case test set EOS manually before last frame and reset"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0100.pcm'; - eosframenum = 500; - workdoneAtEOS = true; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - console.info("get AudioDecoderCaps:"); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0200 - * @tc.name : 002.test flush at running state - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0200', 0, async function (done) { - console.info("case test flush at running state"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0200.pcm'; - workdoneAtEOS = true; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(3000).then(() => { - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.flush().then(() => { - console.info("case flush after 5s"); - }, failCallback).catch(failCatch); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0300 - * @tc.name : 003. test flush at EOS state - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0300', 0, async function (done) { - console.info("case test flush at EOS state"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0300.pcm'; - eosframenum = 200; - flushAtEOS = true; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0400 - * @tc.name : 004. test stop at running state and reset - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0400', 0, async function (done) { - console.info("case test stop at running state and reset"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0400.pcm'; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(5000).then(() => { - audioDecodeProcessor.stop().then(() => { - console.info("case stop after 5s success"); - }, failCallback).catch(failCatch);}); - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioDecodeProcessor = null; - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0500 - * @tc.name : 005. test stop and restart - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0500', 0, async function (done) { - console.info("case test stop and restart"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0500.pcm'; - eosframenum = 200; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(5000).then(() => { - console.info("case stop decoding after 5s"); - }); - await audioDecodeProcessor.stop().then(() => { - console.info("case stop after 5s success"); - }, failCallback).catch(failCatch); - await sleep(2000).then(() => { - console.info("case restart decoding after 2s"); - resetParam(); - readFile(AUDIOPATH); - }); - await audioDecodeProcessor.start().then(() => { - console.info("case restart after 3s success"); - workdoneAtEOS = true; - enqueueAllInputs(inputQueue); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0600 - * @tc.name : 006. test reconfigure for new file with the same format - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0600', 0, async function (done) { - console.info("case test reconfigure codec for new file with the same format"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let mediaDescription2 = { - "channel_count": 1, - "sample_rate": 16000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0600.pcm'; - eosframenum = 200; - resetAtEOS = true; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(10000).then(() => { - console.info("case start configure 2"); - }); - await audioDecodeProcessor.configure(mediaDescription2).then(() => { - console.info("case configure 2 success"); - resetParam(); - readFile(AUDIOPATH2); - }, failCallback).catch(failCatch); - savepath = BASIC_PATH + '0601.pcm'; - workdoneAtEOS = true; - ES = [0, 239, 302, 309, 330, 474, 684, 699, 683, 674, 647, 649, 638, 644, 640, - 639, 650, 702, 713, 718, 707, 707, 683, 670, 674, 699, 654, 650, 715, 770, - 764, 736, 697, 664, 643, 649, 704, 730, 720, 710, 689, 670, 673, 653, 635, - 643, 638, 653, 658, 683, 683, 705, 690, 681, 648, 659, 743, 681, 706, 707, - 718, 714, 746, 725, 741, 709, 675, 675, 751, 698, 736, 738, 711, 702, 691, - 668, 668, 650, 661, 678, 694, 719, 685, 700, 657, 671, 668, 701, 689, 685, - 682, 668, 696, 690, 683, 739, 704, 667, 694, 716, 757, 714, 701, 664, 619, - 609, 591, 644, 573, 572, 605, 595, 597, 529, 581, 578, 586, 537, 577, 535, - 572, 570, 534, 547, 581, 530, 591, 521, 556, 570, 557, 541, 506, 572, 579, - 502, 516, 582, 540, 584, 548, 555, 539, 578, 588, 541, 539, 526, 575, 535, - 571, 525, 569, 560, 584, 551, 574, 572, 537, 550, 582, 512, 559, 593, 601, - 594, 546, 560, 567, 547, 529, 576, 577, 556, 551, 530, 542, 575, 510, 559, - 613, 628, 511, 566, 515, 539, 594, 536, 565, 551, 533, 613, 557, 523, 574, - 582, 616, 610, 573, 509, 535]; - ES_LENGTH = 200; - samplerate = 16; - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare2 success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start2 success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0700 - * @tc.name : 007. test reconfigure for new file with different formats - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_DECODER_FUNCTION_PROMISE_01_0700', 0, async function (done) { - console.info("case test reconfigure codec for new file with different formats"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let mediaDescription2 = { - "channel_count": 1, - "sample_rate": 48000, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0700.pcm'; - eosframenum = 200; - resetAtEOS = true; - needrelease = true; - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioDecoder success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.getAudioDecoderCaps().then((AudioCaps) => { - console.info("case get AudioDecoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(10000).then(() => { - console.info("start createaudiodecoder 2"); - }); - await media.createAudioDecoderByMime('audio/flac').then((processor) => { - console.info("case create createAudioDecoder flac success"); - audioDecodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioDecodeProcessor.configure(mediaDescription2).then(() => { - console.info("case configure 2 success"); - resetParam(); - readFile(AUDIOPATH3); - }, failCallback).catch(failCatch); - savepath = BASIC_PATH + '0701.pcm'; - workdoneAtEOS = true; - ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829, - 2806, 2796, 2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919, - 2839, 2794, 2770, 2763, 2756, 2722, 2950, 2876, 2842, 2827, 2792, 3121, 3075, - 2969, 3240, 3199, 3082, 2975, 2895, 3135, 3024, 2970, 2902, 2860, 2802, 2778, - 2779, 2963, 2893, 2870, 2831, 2800, 2762, 2752, 2760, 2759, 2726, 2889, 2960, - 2876, 3223, 3040, 3006, 3042, 2980, 3097, 3069, 3215, 3365, 3296, 3653, 3480, - 3300, 3140, 3014, 2975, 2952, 2896, 2897, 2842, 2929, 3567, 3929, 3485, 3082, - 3625, 4953, 5239, 5094, 4993, 4821, 4431, 5195, 5542, 5557, 4894, 4414]; - ES_LENGTH = 100; - samplerate = 48; - setCallback(savepath, done); - await audioDecodeProcessor.prepare().then(() => { - console.info("case prepare2 success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.start().then(() => { - console.info("case start2 success"); - }, failCallback).catch(failCatch); - }) -}) diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderMultiInstancesTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderMultiInstancesTest.test.js deleted file mode 100644 index da33ba37d62dd45112ea22be4664d2951a295347..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderMultiInstancesTest.test.js +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderMultiInstances', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH = RESOURCEPATH + 'AAC_48000_32_1.aac'; - let readStreamSync; - let eosframenum = 0; - let samplerate = 44.1; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = []; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function resetParam() { - readStreamSync = undefined; - eosframenum = 0; - samplerate = 44.1; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - }catch(e) { - console.info(e) - } - } - - function readFile(path) { - console.info('read file start execution'); - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - }catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - } - - async function stopWork(audioDecodeProcessor) { - await audioDecodeProcessor.stop().then(() => { - console.info("case stop success") - }, failCallback).catch(failCatch); - } - - async function resetWork(audioDecodeProcessor) { - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - if (needrelease) { - audioDecodeProcessor = null; - } - }, failCallback).catch(failCatch); - } - - async function flushWork(audioDecodeProcessor) { - inputQueue = []; - outputQueue = []; - await audioDecodeProcessor.flush().then(() => { - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }, failCallback).catch(failCatch); - } - - async function doneWork(audioDecodeProcessor) { - await audioDecodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - audioDecodeProcessor = null; - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function enqueueAllInputs(audioDecodeProcessor, queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - timestamp += ES[frameCnt]/samplerate; - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueAllOutputs(audioDecodeProcessor, queue, savapath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - console.info("sawOutputEOS == true"); - if (stopAtEOS) { - await stopWork(audioDecodeProcessor); - } else if (resetAtEOS) { - await resetWork(audioDecodeProcessor); - } else if (flushAtEOS) { - await flushWork(audioDecodeProcessor); - } else if (workdoneAtEOS) { - await doneWork(audioDecodeProcessor); - done(); - } else { - console.info("saw output EOS"); - } - } - else{ - writeFile(savapath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(audioDecodeProcessor, savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(audioDecodeProcessor, inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - console.info("outputbuffer.flags: " + outBuffer.flags); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }, failCallback).catch(failCatch);} - outputQueue.push(outBuffer); - await dequeueAllOutputs(audioDecodeProcessor, outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_MULTIINSTANCE_0100 - * @tc.name : 001.create multiple decoders - * @tc.desc : basic decode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_MULTIINSTANCE_0100', 0, async function (done) { - console.info("case test multiple instances"); - let array = new Array(); - for (let i = 0; i < 2; i += 1) { - await media.createAudioDecoderByMime('audio/mp4a-latm').then((processor) => { - if (typeof(processor) != 'undefined') { - console.info("case create createAudioDecoder success: " + i); - array[i] = processor; - } else { - console.info("case create createAudioDecoder failed: " + i); - } - }, failCallback).catch(failCatch); - } - console.info('case has created multiple decoders'); - for (let j = 0; j < 2; j++) { - resetParam(); - await array[j].reset().then(() => { - console.info("reset decoder " + j); - }, failCallback).catch(failCatch); - await array[j].release().then(() => { - console.info('release success'); - array[j] = null; - }, failCallback).catch(failCatch); - } - done(); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityCallbackTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityCallbackTest.test.js deleted file mode 100644 index 8364daa5f51a3ef7f17a3d591089d3bfef77cd77..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityCallbackTest.test.js +++ /dev/null @@ -1,1348 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderReliabilityCallback', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_reliability_callback'; - const END = 0; - const CONFIGURE = 1; - const PREPARE = 2; - const START = 3; - const FLUSH = 4; - const STOP = 5; - const RESET = 6; - const HOLDON = 7; - const WAITFORALLOUTS = 8; - const CONFIGURE_ERROR = 9; - const PREPARE_ERROR = 10; - const START_ERROR = 11; - const FLUSH_ERROR = 12; - const STOP_ERROR = 13; - const JUDGE_EOS = 14; - const WAITTIME = 3000; - let audioDecodeProcessor; - let readStreamSync; - let EOSFrameNum = 0; - let samplerate = 44.1; - let workdoneAtEOS = false; - let flushAtEOS = false; - let needGetMediaDes = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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]; - let ES_LENGTH = 500; - let mime = 'audio/mp4a-latm'; - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - }; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = null; - readStreamSync = undefined; - EOSFrameNum = 0; - samplerate = 44.1; - workdoneAtEOS = false; - flushAtEOS = false; - needGetMediaDes = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function resetParam() { - readStreamSync = undefined; - EOSFrameNum = 0; - samplerate = 44.1; - workdoneAtEOS = false; - flushAtEOS = false; - needGetMediaDes = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function createAudioDecoder(savepath, mySteps, done) { - media.createAudioDecoderByMime(mime, (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - setCallback(savepath, done); - console.info("case start api test"); - nextStep(mySteps, mediaDescription, done); - }) - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - }catch(e) { - console.info(e) - } - } - - function readFile(path) { - console.info('read file start execution'); - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - }catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - async function doneWork(done) { - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success"); - resetParam(); - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.log("case reset success"); - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioDecodeProcessor = null; - done(); - }) - }) - }) - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - function nextStep(mySteps, mediaDescription, done) { - console.info("case myStep[0]: " + mySteps[0]); - if (mySteps[0] == END) { - console.info('case to done'); - audioDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info(`case release 1`); - audioDecodeProcessor = null; - done(); - }); - } - switch (mySteps[0]) { - case CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - nextStep(mySteps, mediaDescription, done); - }); - break; - case PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - audioDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case START: - mySteps.shift(); - console.info(`case to start`); - if (sawOutputEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - enqueueAllInputs(inputQueue); - } - audioDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case FLUSH: - mySteps.shift(); - console.info(`case to flush`); - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info(`case flush 1`); - if (flushAtEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - flushAtEOS = false; - } - nextStep(mySteps, mediaDescription, done); - }); - break; - case STOP: - mySteps.shift(); - console.info(`case to stop`); - audioDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`case stop 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case RESET: - mySteps.shift(); - console.info(`case to reset`); - resetParam(); - audioDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info(`case reset 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case HOLDON: - mySteps.shift(); - setTimeout(() =>{ - nextStep(mySteps, mediaDescription, done); - }, WAITTIME); - break; - case WAITFORALLOUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - case CONFIGURE_ERROR: - mySteps.shift(); - console.info(`case to configure 2`); - audioDecodeProcessor.configure(mediaDescription, (err) => { - expect(err != undefined).assertTrue(); - console.info(`case configure error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case PREPARE_ERROR: - mySteps.shift(); - console.info(`case to prepare`); - audioDecodeProcessor.prepare((err) => { - expect(err != undefined).assertTrue(); - console.info(`case prepare error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case START_ERROR: - mySteps.shift(); - console.info(`case to start`); - audioDecodeProcessor.start((err) => { - expect(err != undefined).assertTrue(); - console.info(`case start error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case FLUSH_ERROR: - mySteps.shift(); - console.info(`case to flush`); - audioDecodeProcessor.flush((err) => { - expect(err != undefined).assertTrue(); - console.info(`case flush error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case STOP_ERROR: - mySteps.shift(); - console.info(`case to stop`); - audioDecodeProcessor.stop((err) => { - expect(err != undefined).assertTrue(); - console.info(`case stop error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case JUDGE_EOS: - mySteps.shift(); - console.info(`case judge EOS state`); - expect(sawOutputEOS).assertTrue(); - nextStep(mySteps, mediaDescription, done); - break; - default: - break; - } - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - console.info("frameCnt:" + frameCnt); - if (frameCnt == EOSFrameNum || frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } - else{ - console.info("read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - timestamp += ES[frameCnt]/samplerate; - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject, () => { - console.info('queueInput success'); - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (workdoneAtEOS) { - await doneWork(done); - } else { - console.info("sawOutputEOS = true"); - } - } - else{ - console.info("not last frame, continue"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject, () => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - expect(err).assertUndefined(); - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }); - } - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0100 - * @tc.name : 001.create -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0100.pcm'; - let mySteps = new Array(CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0300 - * @tc.name : 003.start -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, CONFIGURE_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0700.pcm'; - let mySteps = new Array(RESET, CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0800.pcm'; - let mySteps = new Array(CONFIGURE, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_CALLBACK_0900', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0900.pcm'; - let mySteps = new Array(CONFIGURE, RESET, CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0100.pcm'; - let mySteps = new Array(PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, PREPARE_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0100 - * @tc.name : 001.create -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0100.pcm'; - let mySteps = new Array(START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0200 - * @tc.name : 002.configure -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0200.pcm'; - let mySteps = new Array(CONFIGURE, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0400 - * @tc.name : 004.start -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0500 - * @tc.name : 005.flush -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0600 - * @tc.name : 006.stop -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, START_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0800 - * @tc.name : 008.reset -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0100 - * @tc.name : 001.create -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0100.pcm'; - let mySteps = new Array(FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0200.pcm'; - let mySteps = new Array(CONFIGURE, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0400 - * @tc.name : 004.start -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0100 - * @tc.name : 001.create -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0100.pcm'; - let mySteps = new Array(STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0200.pcm'; - let mySteps = new Array(CONFIGURE, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0400 - * @tc.name : 004.start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, STOP, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0100 - * @tc.name : 001.create -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0100.pcm'; - let mySteps = new Array(RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0200.pcm'; - let mySteps = new Array(CONFIGURE, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0400 - * @tc.name : 004.start -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0100.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, WAITFORALLOUTS); - EOSFrameNum = 2; - flushAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, CONFIGURE, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, WAITFORALLOUTS); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js deleted file mode 100644 index 83f32598936817f271348df5f3902fc9a13599cc..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderReliabilityPromiseTest.test.js +++ /dev/null @@ -1,1349 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioDecoderReliabilityPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiodecoder/' - const AUDIOPATH = RESOURCEPATH + 'AAC_48000_32_1.aac'; - const BASIC_PATH = RESOURCEPATH + 'results/decode_reliability_promise'; - const END = 0; - const CONFIGURE = 1; - const PREPARE = 2; - const START = 3; - const FLUSH = 4; - const STOP = 5; - const RESET = 6; - const HOLDON = 7; - const WAITFORALLOUTS = 8; - const CONFIGURE_ERROR = 9; - const PREPARE_ERROR = 10; - const START_ERROR = 11; - const FLUSH_ERROR = 12; - const STOP_ERROR = 13; - const JUDGE_EOS = 14; - const WAITTIME = 3000; - let audioDecodeProcessor; - let readStreamSync; - let EOSFrameNum = 0; - let samplerate = 44.1; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - let ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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]; - let ES_LENGTH = 500; - let mime = 'audio/mp4a-latm'; - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - }; - let expectError = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioDecodeProcessor = null; - readStreamSync = undefined; - EOSFrameNum = 0; - samplerate = 44.1; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES = [0, 283, 336, 291, 405, 438, 411, 215, 215, 313, 270, 342, 641, 554, 545, 545, 546, - 541, 540, 542, 552, 537, 533, 498, 472, 445, 430, 445, 427, 414, 386, 413, 370, 380, - 401, 393, 369, 391, 367, 395, 396, 396, 385, 391, 384, 395, 392, 386, 388, 384, 379, - 376, 381, 375, 373, 349, 391, 357, 384, 395, 384, 380, 386, 372, 386, 383, 378, 385, - 385, 384, 342, 390, 379, 387, 386, 393, 397, 362, 393, 394, 391, 383, 385, 377, 379, - 381, 369, 375, 379, 346, 382, 356, 361, 366, 394, 393, 385, 362, 406, 399, 384, 377, - 385, 389, 375, 346, 396, 388, 381, 383, 352, 357, 397, 382, 395, 376, 388, 373, 374, - 353, 383, 384, 393, 379, 348, 364, 389, 380, 381, 388, 423, 392, 381, 368, 351, 391, - 355, 358, 395, 390, 385, 382, 383, 388, 388, 389, 376, 379, 376, 384, 369, 354, 390, - 389, 396, 393, 382, 385, 353, 383, 381, 377, 411, 387, 390, 377, 349, 381, 390, 378, - 373, 375, 381, 351, 392, 381, 380, 381, 378, 387, 379, 383, 348, 386, 364, 386, 371, - 399, 399, 385, 380, 355, 397, 395, 382, 380, 386, 352, 387, 390, 373, 372, 388, 378, - 385, 368, 385, 370, 378, 373, 383, 368, 373, 388, 351, 384, 391, 387, 389, 383, 355, - 361, 392, 386, 354, 394, 392, 397, 392, 352, 381, 395, 349, 383, 390, 392, 350, 393, - 393, 385, 389, 393, 382, 378, 384, 378, 375, 373, 375, 389, 377, 383, 387, 373, 344, - 388, 379, 391, 373, 384, 358, 361, 391, 394, 363, 350, 361, 395, 399, 389, 398, 375, - 398, 400, 381, 354, 363, 366, 400, 400, 356, 370, 400, 394, 398, 385, 378, 372, 354, - 359, 393, 381, 363, 396, 396, 355, 390, 356, 355, 371, 399, 367, 406, 375, 377, 405, - 401, 390, 393, 392, 384, 386, 374, 358, 397, 389, 393, 385, 345, 379, 357, 388, 356, - 381, 389, 367, 358, 391, 360, 394, 396, 357, 395, 388, 394, 383, 357, 383, 392, 394, - 376, 379, 356, 386, 395, 387, 377, 377, 389, 377, 385, 351, 387, 350, 388, 384, 345, - 358, 368, 399, 394, 385, 384, 395, 378, 387, 386, 386, 376, 375, 382, 351, 359, 356, - 401, 388, 363, 406, 363, 374, 435, 366, 400, 393, 392, 371, 391, 359, 359, 397, 388, - 390, 420, 411, 369, 384, 382, 383, 383, 375, 381, 361, 380, 348, 379, 386, 379, 379, - 386, 371, 352, 378, 378, 388, 384, 385, 352, 355, 387, 383, 379, 362, 386, 399, 376, - 390, 350, 387, 357, 403, 398, 397, 360, 351, 394, 400, 399, 393, 388, 395, 370, 377, - 395, 360, 346, 381, 370, 390, 380, 391, 387, 382, 384, 383, 354, 349, 394, 358, 387, - 400, 386, 402, 354, 396, 387, 391, 365, 377, 359, 361, 365, 395, 388, 388, 384, 388, - 378, 374, 382, 376, 377, 389, 378, 341, 390, 376, 381, 375, 414, 368, 369, 387, 411, - 396, 391, 378, 389, 349, 383, 344, 381, 387, 380, 353, 361, 391, 365, 390, 396, 382, - 386, 385, 385, 409, 387, 386, 378, 372, 372, 374, 349, 388, 389, 348, 395, 380, 382, - 388, 375, 347, 383, 359, 389, 368, 361, 405, 398, 393, 395, 359, 360, 395, 395, 362, - 354, 388, 348, 388, 386, 390, 350, 388, 356, 369, 364, 404, 404, 391, 394, 385, 439, - 432, 375, 366, 441, 362, 367, 382, 374, 346, 391, 371, 354, 376, 390, 373, 382, 385, - 389, 378, 377, 347, 414, 338, 348, 385, 352, 385, 386, 381, 388, 387, 364, 465, 405, - 443, 387, 339, 376, 337, 379, 387, 370, 374, 358, 354, 357, 393, 356, 381, 357, 407, - 361, 397, 362, 394, 394, 392, 394, 391, 381, 386, 379, 354, 351, 392, 408, 393, 389, - 388, 385, 375, 388, 375, 388, 375, 354, 384, 379, 386, 394, 383, 359, 405, 395, 352, - 345, 403, 427, 373, 380, 350, 415, 378, 434, 385, 388, 387, 400, 405, 329, 391, 356, - 419, 358, 359, 375, 367, 391, 359, 369, 361, 376, 378, 379, 348, 390, 345, 388, 390, - 406, 349, 368, 364, 391, 384, 401, 384, 391, 361, 399, 359, 386, 392, 382, 386, 380, - 383, 345, 376, 393, 400, 395, 343, 352, 354, 381, 388, 357, 393, 389, 384, 389, 388, - 384, 404, 372, 358, 381, 352, 355, 485, 393, 371, 376, 389, 377, 391, 387, 376, 342, - 390, 375, 379, 396, 376, 402, 353, 392, 382, 383, 387, 386, 372, 377, 382, 388, 381, - 387, 357, 393, 385, 346, 389, 388, 357, 362, 404, 398, 397, 402, 371, 351, 370, 362, - 350, 388, 399, 402, 406, 377, 396, 359, 372, 390, 392, 368, 383, 346, 384, 381, 379, - 367, 384, 389, 381, 371, 358, 422, 372, 382, 374, 444, 412, 369, 362, 373, 389, 401, - 383, 380, 366, 365, 361, 379, 372, 345, 382, 375, 376, 375, 382, 356, 395, 383, 384, - 391, 361, 396, 407, 365, 351, 385, 378, 403, 344, 352, 387, 397, 399, 377, 371, 381, - 415, 382, 388, 368, 383, 405, 390, 386, 384, 374, 375, 381, 371, 372, 374, 377, 346, - 358, 381, 377, 359, 385, 396, 385, 390, 389, 391, 375, 357, 389, 390, 377, 370, 379, - 351, 381, 381, 380, 371, 386, 389, 389, 383, 362, 393, 388, 355, 396, 383, 352, 384, - 352, 383, 362, 396, 385, 396, 357, 388, 382, 377, 373, 379, 383, 386, 350, 393, 355, - 380, 401, 392, 391, 402, 391, 427, 407, 394, 332, 398, 367, 373, 343, 381, 383, 386, - 382, 349, 353, 393, 378, 386, 375, 390, 356, 392, 384, 387, 380, 381, 385, 386, 383, - 378, 379, 359, 381, 382, 388, 357, 357, 397, 358, 424, 382, 352, 409, 374, 368, 365, - 399, 352, 393, 389, 385, 352, 380, 398, 389, 385, 387, 387, 353, 402, 396, 386, 357, - 395, 368, 369, 407, 394, 383, 362, 380, 385, 368, 375, 365, 379, 377, 388, 380, 346, - 383, 381, 399, 359, 386, 455, 368, 406, 377, 339, 381, 377, 373, 371, 338, 371, 387, - 376, 386, 388, 382, 381, 377, 389, 352, 391, 396, 398, 374, 352, 358, 387, 368, 401, - 395, 387, 387, 354, 393, 401, 382, 390, 371, 374, 387, 377, 379, 377, 383, 374, 367, - 372, 393, 365, 392, 350, 378, 385, 377, 382, 388, 353, 389, 359, 366, 404, 390, 381, - 396, 388, 394, 380, 379, 372, 355, 397, 382, 351, 397, 378, 375, 378, 369, 387, 380, - 383, 346, 357, 362, 371, 413, 393, 365, 395, 391, 384, 386, 385, 390, 355, 385, 394, - 384, 383, 431, 369, 373, 392, 397, 396, 353, 391, 352, 375, 382, 397, 393, 371, 403, - 375, 338, 418, 368, 372, 370, 344, 392, 360, 402, 402, 425, 374, 378, 376, 380, 378, - 347, 379, 414, 377, 390, 383, 357, 390, 385, 377, 378, 368, 399, 389, 383, 368, 372, - 358, 386, 355, 380, 386, 349, 381, 379, 380, 351, 389, 380, 353, 359, 365, 370, 407, - 388, 381, 358, 364, 396, 369, 407, 391, 358, 440, 419, 412, 395, 344, 382, 391, 353, - 403, 391, 371, 354, 362, 407, 411, 397, 385, 388, 357, 348, 368, 401, 404, 380, 370, - 369, 365, 349, 373, 346, 351, 394, 399, 387, 393, 363, 402, 394, 375, 389, 386, 395, - 386, 386, 353, 403, 363, 376, 398, 383, 372, 350, 381, 353, 445, 386, 369, 383, 351, - 392, 397, 384, 389, 354, 400, 392, 379, 386, 355, 391, 388, 361, 390, 408, 357, 390, - 387, 352, 393, 357, 358, 401, 383, 391, 384, 388, 377, 380, 354, 393, 387, 357, 396, - 360, 362, 388, 390, 359, 367, 366, 396, 388, 394, 363, 391, 394, 351, 391, 391, 350, - 360, 365, 397, 366, 375, 400, 412, 372, 380, 383, 384, 383, 390, 380, 361, 363, 387, - 358, 385, 359, 385, 399, 351, 392, 388, 385, 384, 350, 379, 385, 383, 375, 389, 381, - 382, 376, 389, 390, 375, 381, 382, 390, 385, 380, 359, 351, 383, 391, 388, 379, 354, - 387, 382, 358, 381, 381, 386, 397, 373, 381, 387, 387, 381, 378, 383, 370, 360, 386, - 362, 402, 357, 398, 398, 397, 378, 394, 381, 375, 380, 390, 373, 369, 388, 347, 356, - 384, 391, 386, 394, 388, 357, 403, 381, 376, 414, 383, 387, 349, 379, 383, 384, 377, - 394, 426, 373, 392, 367, 381, 378, 378, 374, 373, 369, 368, 332, 335, 381, 392, 388, - 381, 424, 367, 398, 399, 392, 379, 391, 379, 370, 343, 405, 378, 367, 345, 379, 347, - 388, 353, 392, 382, 384, 387, 350, 363, 398, 398, 359, 402, 454, 440, 341, 383, 381, - 385, 355, 349, 369, 360, 388, 383, 354, 435, 405, 404, 399, 385, 386, 364, 388, 373, - 376, 384, 395, 400, 408, 390, 375, 341, 372, 371, 407, 345, 378, 345, 407, 365, 398, - 396, 339, 379, 375, 410, 386, 407, 387, 365, 375, 384, 347, 393, 377, 350, 376, 375, - 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(async function() { - console.info('afterEach case'); - if (audioDecodeProcessor != null) { - await audioDecodeProcessor.release().then(() => { - console.info('audioDecodeProcessor release success'); - audioDecodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - 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(); - } - - function resetParam() { - readStreamSync = undefined; - EOSFrameNum = 0; - samplerate = 44.1; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function createAudioDecoder(savepath, mySteps, done) { - media.createAudioDecoderByMime(mime, (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioDecoder 1`); - audioDecodeProcessor = processor; - setCallback(savepath, done); - console.info("case start api test"); - nextStep(mySteps, done); - }) - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - }catch(e) { - console.info(e) - } - } - - function readFile(path) { - console.info('read file start execution'); - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - }catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - async function doneWork() { - await audioDecodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioDecodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await audioDecodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioDecodeProcessor = null; - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - function nextStep(mySteps, done) { - console.info("case myStep[0]: " + mySteps[0]); - if (mySteps[0] == END) { - audioDecodeProcessor.release().then(() => { - console.info("case release success"); - audioDecodeProcessor = null; - done(); - }, failCallback).catch(failCatch); - } - switch (mySteps[0]) { - case CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure 1`); - readFile(AUDIOPATH); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - audioDecodeProcessor.prepare().then(() => { - console.info(`case prepare 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case START: - mySteps.shift(); - console.info(`case to start`); - if (sawOutputEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - enqueueAllInputs(inputQueue); - } - audioDecodeProcessor.start().then(() => { - console.info(`case start 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case FLUSH: - mySteps.shift(); - console.info(`case to flush`); - inputQueue = []; - outputQueue = []; - audioDecodeProcessor.flush().then(() => { - console.info(`case flush 1`); - if (flushAtEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - flushAtEOS = false; - } - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case STOP: - mySteps.shift(); - console.info(`case to stop`); - audioDecodeProcessor.stop().then(() => { - console.info(`case stop 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case RESET: - mySteps.shift(); - console.info(`case to reset`); - resetParam(); - audioDecodeProcessor.reset().then(() => { - console.info(`case reset 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case HOLDON: - mySteps.shift(); - setTimeout(() =>{ - nextStep(mySteps, done); - }, WAITTIME); - break; - case WAITFORALLOUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - case CONFIGURE_ERROR: - mySteps.shift(); - console.info(`case to configure 2`); - audioDecodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case PREPARE_ERROR: - mySteps.shift(); - console.info(`case to prepare 2`); - audioDecodeProcessor.prepare().then(() => { - console.info(`case prepare error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case START_ERROR: - mySteps.shift(); - console.info(`case to start 2`); - audioDecodeProcessor.start().then(() => { - console.info(`case start error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case FLUSH_ERROR: - mySteps.shift(); - console.info(`case to flush 2`); - audioDecodeProcessor.flush().then(() => { - console.info(`case flush error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case STOP_ERROR: - mySteps.shift(); - console.info(`case to stop 2`); - audioDecodeProcessor.stop().then(() => { - console.info(`case stop error 1`); - 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, done); - break; - default: - break; - } - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == EOSFrameNum || frameCnt == ES_LENGTH + 1) { - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[frameCnt]; - getContent(inputobject.data, ES[frameCnt]); - inputobject.flags = 0; - } - timestamp += ES[frameCnt]/samplerate; - frameCnt += 1; - audioDecodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueAllOutputs(queue, savapath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (workdoneAtEOS) { - await doneWork(); - done(); - } else { - console.info("sawOutputEOS = true") - } - } - else{ - console.info("not last frame, continue"); - } - audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioDecodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioDecodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needGetMediaDes) { - audioDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }, failCallback).catch(failCatch);} - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioDecodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioDecodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0100 - * @tc.name : 001.create -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0100.pcm'; - let mySteps = new Array(CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0300 - * @tc.name : 003.start -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, CONFIGURE_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0700.pcm'; - let mySteps = new Array(RESET, CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0800.pcm'; - let mySteps = new Array(CONFIGURE, CONFIGURE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_CONFIGURE_PROMISE_0900', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0900.pcm'; - let mySteps = new Array(CONFIGURE, RESET, CONFIGURE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0100.pcm'; - let mySteps = new Array(PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, PREPARE_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_PREPARE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, PREPARE_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0100 - * @tc.name : 001.create -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0100.pcm'; - let mySteps = new Array(START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0200 - * @tc.name : 002.configure -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0200.pcm'; - let mySteps = new Array(CONFIGURE, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0400 - * @tc.name : 004.start -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0500 - * @tc.name : 005.flush -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0600 - * @tc.name : 006.stop -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, START_ERROR, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0800 - * @tc.name : 008.reset -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_START_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, START_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0100 - * @tc.name : 001.create -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0100.pcm'; - let mySteps = new Array(FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0200.pcm'; - let mySteps = new Array(CONFIGURE, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0400 - * @tc.name : 004.start -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_FLUSH_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, FLUSH_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0100 - * @tc.name : 001.create -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0100.pcm'; - let mySteps = new Array(STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0200.pcm'; - let mySteps = new Array(CONFIGURE, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0400 - * @tc.name : 004.start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, STOP, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_STOP_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, STOP_ERROR, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0100 - * @tc.name : 001.create -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0100.pcm'; - let mySteps = new Array(RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0200.pcm'; - let mySteps = new Array(CONFIGURE, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0400 - * @tc.name : 004.start -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0600.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0700.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_RESET_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0800.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, RESET, END); - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0100.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0200.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, WAITFORALLOUTS); - EOSFrameNum = 2; - flushAtEOS = true; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0300.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, CONFIGURE, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0400.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, WAITFORALLOUTS); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_DECODER_API_EOS_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0500.pcm'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, STOP, END); - EOSFrameNum = 2; - createAudioDecoder(savepath, mySteps, done); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/List.test.js deleted file mode 100644 index 239657117cec09e76461aa8c231c8ba734a5e8bb..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/List.test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -require('./AudioDecoderFuncPromiseTest.test.js') -require('./AudioDecoderFuncCallbackTest.test.js') -require('./AudioDecoderFormatPromiseTest.test.js') -require('./AudioDecoderFormatCallbackTest.test.js') -require('./AudioDecoderReliabilityPromiseTest.test.js') -require('./AudioDecoderReliabilityCallbackTest.test.js') -require('./AudioDecoderMultiInstancesTest.test.js') -require('./AudioDecoderEnumTest.test.js') - diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/media/icon.png b/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/audioDecoder/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/multimedia/media/media_js_standard/audioEncoder/BUILD.gn b/multimedia/media/media_js_standard/audioEncoder/BUILD.gn deleted file mode 100644 index 0b47cc4f4213b091cff7f4b17024d371adb38bcc..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("audio_encoder_js_hap") { - hap_profile = "./src/main/config.json" - js2abc = true - deps = [ - ":audio_encoder_js_assets", - ":audio_encoder_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAudioEncoderJsTest" -} -ohos_js_assets("audio_encoder_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("audio_encoder_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/media/media_js_standard/audioEncoder/Test.json b/multimedia/media/media_js_standard/audioEncoder/Test.json deleted file mode 100644 index c3eecbbbfeeae448175937755be68eac99886613..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/Test.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "description": "Configuration for audioEncoder Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "2000000", - "package": "ohos.acts.multimedia.audio.audioencoder", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAudioEncoderJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/audio/audioEncode/S16LE.pcm ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "rm -R /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/results", - "mkdir -p /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/results/", - "chmod 777 -R /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder", - "chmod 777 /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/*" - ], - "teardown-command":[ - ] - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/audioEncoder/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/audioEncoder/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/config.json b/multimedia/media/media_js_standard/audioEncoder/src/main/config.json deleted file mode 100644 index 04226482df0376f8d6dce28cda94068c0b6fab98..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.audio.audioencoder", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "iconId": 16777218, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "descriptionId": 16777217, - "visible": true, - "labelId": 16777216, - "icon": "$media:icon", - "name": "ohos.acts.multimedia.audio.audioencoder.MainAbility", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "homeAbility": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "mainAbility": "ohos.acts.multimedia.audio.audioencoder.MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "ohos.acts.multimedia.audio.audioencoder", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/app.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/app.js deleted file mode 100644 index 830070d196d86b127cea947d168bfd116f446205..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/en-US.json b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/zh-CN.json b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.css b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.css deleted file mode 100644 index 9f1321a1dcd401eb5367f0a0715959581fdaebb4..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.hml b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 6892123992c660d987c2b58eb133e13504ab2072..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.js deleted file mode 100644 index 67f8b8567ccc4932331b7a18a6b947340d84fb40..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - this.timeout = 60000 - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js deleted file mode 100644 index 63fbf83affe8933bb51d6e8328ec39d98005aa22..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioEncoderFuncCallback', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/' - const AUDIOPATH = RESOURCEPATH + 'S16LE.pcm'; - const BASIC_PATH = RESOURCEPATH + 'results/encode_func_callback_'; - let audioEncodeProcessor; - let readStreamSync; - let eosframenum = 0; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - const ES = [0, 4096]; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioEncodeProcessor = null; - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES_LENGTH = 1500; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioEncodeProcessor != null) { - await audioEncodeProcessor.release().then(() => { - console.info('audioEncodeProcessor release success'); - audioEncodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function resetParam() { - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needrelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeHead(path, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let head = new ArrayBuffer(7); - addADTStoPacket(head, len); - let num = writestream.writeSync(head, {length:7}); - console.info(' writeSync head num = ' + num); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - - function readFile(path) { - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - function addADTStoPacket(head, len) { - let view = new Uint8Array(head) - console.info("start add ADTS to Packet"); - let packetLen = len + 7; // 7: head length - let profile = 2; // 2: AAC LC - let freqIdx = 4; // 4: 44100HZ - let chanCfg = 2; // 2: 2 channel - view[0] = 0xFF; - view[1] = 0xF9; - view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2); - view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11); - view[4] = (packetLen & 0x7FF) >> 3; - view[5] = ((packetLen & 7) << 5) + 0x1F; - view[6] = 0xFC; - } - - async function stopWork() { - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success") - }) - } - - async function resetWork() { - resetParam(); - audioEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info("case reset success"); - if (needrelease) { - audioEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info("case release success"); - audioEncodeProcessor = null; - }) - } - }) - } - - async function flushWork() { - inputQueue = []; - outputQueue = []; - audioEncodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }) - } - - async function doneWork(done) { - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success"); - resetParam(); - audioEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - audioEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioEncodeProcessor = null; - done(); - }) - }) - }) - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) { - console.info("EOS frame seperately") - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[1]; - getContent(inputobject.data, ES[1]); - inputobject.flags = 0; - } - timestamp += 23; - frameCnt += 1; - audioEncodeProcessor.pushInputData(inputobject, () => { - console.info('queueInput success'); - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (stopAtEOS) { - await stopWork(); - } else if (resetAtEOS) { - await resetWork(); - } else if (flushAtEOS) { - await flushWork(); - } else if (workdoneAtEOS) { - await doneWork(done); - } else { - console.info("sawOutputEOS = true"); - } - } - else{ - writeHead(savepath, outputobject.length); - writeFile(savepath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioEncodeProcessor.freeOutputBuffer(outputobject, () => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioEncodeProcessor.on('needInputData', async(inBuffer) => { - console.info('case inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('case outputBufferAvailable'); - if (needGetMediaDes) { - audioEncodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - expect(err).assertUndefined(); - console.info("case get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }); - } - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioEncodeProcessor.on('streamChanged',(format) => { - console.info('case Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_00_0100 - * @tc.name : 000.test set EOS after last frame and reset - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) { - console.info("test set EOS after last frame and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let mediaDescription2 = { - "codec_mime": 'audio/mp4a-latm', - } - let savepath = BASIC_PATH + '0000.aac'; - needGetMediaDes = true; - workdoneAtEOS = true; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, AudioCaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info(`AudioCaps: ` + AudioCaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info(`case getMediaCapability 1`); - mediaCaps.getAudioEncoderCaps((err, audioCaps) => { - expect(err).assertUndefined(); - console.info('getAudioDecoderCaps success'); - if (typeof (audioCaps) != 'undefined') { - console.info("case audioCaps " + audioCaps); - } else { - console.info("case audioCaps is not defined"); - } - }) - mediaCaps.findAudioEncoder(mediaDescription2, (err, codecname) => { - expect(err).assertUndefined(); - console.info('findAudioEncoder success'); - if (typeof (codecname) != 'undefined') { - console.info("case codecname " + codecname); - } else { - console.info("case codecname is not defined"); - } - }) - }) - media.createAudioEncoderByName('avenc_aac', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder by mime 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0100 - * @tc.name : 001.test set EOS manually before last frame and reset - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { - console.info("case test set EOS manually before last frame and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0100.aac'; - eosframenum = 500; - workdoneAtEOS = true; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0200 - * @tc.name : 002.test flush at running state - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { - console.info("case test flush at running state"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0200.aac'; - workdoneAtEOS = true; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - setTimeout(() => {eventEmitter.emit('flush')},5000) - }) - }); - eventEmitter.on('flush', () => { - inputQueue = []; - outputQueue = []; - audioEncodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info(`case flush after 5s`); - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0300 - * @tc.name : 003. test flush at EOS state - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { - console.info("case test flush at EOS state"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0300.aac'; - eosframenum = 500; - flushAtEOS = true; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0400 - * @tc.name : 004.test stop at running state and reset - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { - console.info("case test stop at running state and reset"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0400.aac'; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - eventEmitter.emit('stop'); - }) - }); - eventEmitter.on('stop', () => { - sleep(5000).then(() => { - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`case stop 1`); - eventEmitter.emit('reset'); - }) - }) - }); - eventEmitter.on('reset', () => { - resetParam(); - audioEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info(`case reset 1`); - eventEmitter.emit('release'); - }) - }); - eventEmitter.on('release', () => { - audioEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info(`case release 1`); - audioEncodeProcessor = null; - done(); - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0500 - * @tc.name : 005.test stop and restart - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { - console.info("case test stop and restart"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0500.aac'; - eosframenum = 100; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - eventEmitter.emit('stop'); - }) - }); - eventEmitter.on('stop', () => { - sleep(5000).then(() => { - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`stop after 5s`); - resetParam(); - readFile(AUDIOPATH); - eventEmitter.emit('restart'); - }) - }) - }); - eventEmitter.on('restart', () => { - sleep(2000).then(() => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`restart after 2s`); - workdoneAtEOS = true; - enqueueAllInputs(inputQueue); - }) - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0600 - * @tc.name : 006.test reconfigure for new file with the same format - * @tc.desc : basic Encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_01_0600', 0, async function (done) { - console.info("case test reconfigure for new file with the same format"); - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0600.aac'; - eosframenum = 100; - resetAtEOS = true; - let mediaDescription2 = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let hasreconfigured = false; - eventEmitter.on('getAudioEncoderCaps', () => { - audioEncodeProcessor.getAudioEncoderCaps((err, Audiocaps) => { - expect(err).assertUndefined(); - console.info(`case getAudioEncoderCaps 1`); - console.info("AudioCaps: " + Audiocaps); - eventEmitter.emit('configure', mediaDescription); - }) - }); - eventEmitter.on('configure', (mediaDescription) => { - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - setCallback(savepath, done); - eventEmitter.emit('start'); - }) - }); - eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - if (!hasreconfigured) { - eventEmitter.emit('reconfigure', mediaDescription2); - } - }) - }); - eventEmitter.on('reconfigure', (mediaDescription2) => { - sleep(10000).then(() => { - audioEncodeProcessor.configure(mediaDescription2, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 2`); - resetParam(); - readFile(AUDIOPATH) - savepath = BASIC_PATH + '0601.aac'; - workdoneAtEOS = true; - hasreconfigured = true; - eventEmitter.emit('prepare'); - }) - }) - }); - media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - eventEmitter.emit('getAudioEncoderCaps'); - }) - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js deleted file mode 100644 index 80fae451b2b657b69fbb13115af9bfd2c1a56e37..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncPromiseTest.test.js +++ /dev/null @@ -1,649 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioEncoderFuncPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/' - const AUDIOPATH = RESOURCEPATH + 'S16LE.pcm'; - const BASIC_PATH = RESOURCEPATH + 'results/encode_func_promise_'; - let audioEncodeProcessor; - let readStreamSync; - let eosframenum = 0; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needgetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - const ES = [0, 4096]; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioEncodeProcessor = null; - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needgetMediaDes = false; - needrelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES_LENGTH = 1500; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioEncodeProcessor != null) { - await audioEncodeProcessor.release().then(() => { - console.info('audioEncodeProcessor release success'); - audioEncodeProcessor = null; - }, failCallback).catch(failCatch); - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function resetParam() { - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needgetMediaDes = false; - needrelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeHead(path, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let head = new ArrayBuffer(7); - addADTStoPacket(head, len); - let num = writestream.writeSync(head, {length:7}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - - function readFile(path) { - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - function addADTStoPacket(head, len) { - let view = new Uint8Array(head); - console.info("start add ADTS to Packet"); - let packetLen = len + 7; // 7: head length - let profile = 2; // 2: AAC LC - let freqIdx = 4; // 4: 44100HZ - let chanCfg = 2; // 2: 2 channel - view[0] = 0xFF; - view[1] = 0xF9; - view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2); - view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11); - view[4] = (packetLen & 0x7FF) >> 3; - view[5] = ((packetLen & 7) << 5) + 0x1F; - view[6] = 0xFC; - } - - async function stopWork() { - await audioEncodeProcessor.stop().then(() => { - console.info("case stop success") - }, failCallback).catch(failCatch); - } - - async function resetWork() { - resetParam(); - await audioEncodeProcessor.reset().then(async() => { - console.info("case reset success"); - if (needrelease) { - await audioEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - }, failCallback).catch(failCatch); - } - - async function flushWork() { - inputQueue = []; - outputQueue = []; - await audioEncodeProcessor.flush().then(() => { - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }, failCallback).catch(failCatch); - } - - async function doneWork() { - await audioEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now();Date.now() - t <= time;); - } - - async function enqueueInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - console.info("case frameCnt:" + frameCnt); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) { - console.info("case EOS frame seperately") - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[1]; - getContent(inputobject.data, ES[1]); - inputobject.flags = 0; - } - timestamp += 23; - frameCnt += 1; - audioEncodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (stopAtEOS) { - await stopWork(); - } else if (resetAtEOS) { - await resetWork(); - } else if (flushAtEOS) { - await flushWork(); - } else if (workdoneAtEOS) { - await doneWork(); - done(); - } else { - console.info('sawOutputEOS = true'); - } - } - else{ - writeHead(savepath, outputobject.length); - writeFile(savepath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioEncodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioEncodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueInputs(inputQueue); - }); - audioEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needgetMediaDes) { - audioEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needgetMediaDes=false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - await dequeueOutputs(outputQueue, savepath, done); - }); - audioEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_00_0100 - * @tc.name : 000.test set EOS after last frame and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let mediaDescription2 = { - "codec_mime": 'audio/mp4a-latm', - } - let savepath = BASIC_PATH + '0000.aac'; - needgetMediaDes = true; - workdoneAtEOS = true; - await media.getMediaCapability().then((mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - 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); - 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; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps) - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success") - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0100 - * @tc.name : 001.test set EOS manually before last frame and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0100.aac'; - eosframenum = 500; - workdoneAtEOS = true; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0200 - * @tc.name : 002.test flush at running state - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0200.aac'; - workdoneAtEOS = true; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps) - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH) - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success") - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success") - }, failCallback).catch(failCatch); - await sleep(5000).then(() => { - inputQueue = []; - outputQueue = []; - audioEncodeProcessor.flush().then(() => { - console.info("case flush after 5s") - }, failCallback).catch(failCatch); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0300 - * @tc.name : 003.test flush at EOS state - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0300.aac'; - eosframenum = 500; - flushAtEOS = true; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0400 - * @tc.name : 004.test stop at running state and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0400.aac'; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(5000).then(() => { - audioEncodeProcessor.stop().then(() => { - console.info("stop after 5s success"); - }, failCallback).catch(failCatch);}); - resetParam(); - await audioEncodeProcessor.reset().then(() => { - console.info("reset success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0500 - * @tc.name : 005.test stop and restart - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0500', 0, async function (done) { - console.info("case test stop and restart"); - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0500.aac'; - eosframenum = 100; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await sleep(5000).then(() => { - console.info("stop encoding after 5s"); - }); - await audioEncodeProcessor.stop().then(() => { - console.info("case stop after 5s success"); - }, failCallback).catch(failCatch); - await sleep(2000).then(() => { - console.info("restart encoding after 2s"); - resetParam(); - readFile(AUDIOPATH); - }); - await audioEncodeProcessor.start().then(() => { - console.info("case restart after 3s success"); - workdoneAtEOS = true; - enqueueInputs(inputQueue); - }, failCallback).catch(failCatch); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_FUNCTION_PROMISE_01_0600 - * @tc.name : 006.test reconfigure for new file with the same format - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - 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": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - let savepath = BASIC_PATH + '0600.aac'; - eosframenum = 100; - resetAtEOS = true; - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - console.info("case create createAudioEncoder success"); - audioEncodeProcessor = processor; - }, failCallback).catch(failCatch); - await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => { - console.info("case get AudioEncoderCaps success"); - console.info("print AudioCaps: " + AudioCaps); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - setCallback(savepath, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - let mediaDescription2 = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - } - await sleep(10000).then(() => { - console.info("start configure 2"); - }); - await audioEncodeProcessor.configure(mediaDescription2).then(() => { - console.info("configure 2 success"); - resetParam(); - readFile(AUDIOPATH); - }, failCallback).catch(failCatch); - let savepath2 = BASIC_PATH + '0601.aac'; - workdoneAtEOS = true; - setCallback(savepath2, done); - await audioEncodeProcessor.prepare().then(() => { - console.info("prepare2 success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.start().then(() => { - console.info("start2 success"); - }, failCallback).catch(failCatch); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderMultiInstancesTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderMultiInstancesTest.test.js deleted file mode 100644 index 3a110986a0f10500865b3dce46e0b68731e78ac7..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderMultiInstancesTest.test.js +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioEncoderFuncPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/' - const AUDIOPATH = RESOURCEPATH + 'S16LE.pcm'; - let readStreamSync; - let eosframenum = 0; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needgetMediaDes = false; - let needrelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - const ES = [0, 4096]; - let ES_LENGTH = 1500; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needgetMediaDes = false; - needrelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES_LENGTH = 1500; - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function resetParam() { - readStreamSync = undefined; - eosframenum = 0; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - workdoneAtEOS = false; - needgetMediaDes = false; - needrelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function writeHead(path, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let head = new ArrayBuffer(7); - addADTStoPacket(head, len); - let num = writestream.writeSync(head, {length:7}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - - function readFile(path) { - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - function addADTStoPacket(head, len) { - let view = new Uint8Array(head); - console.info("start add ADTS to Packet"); - let packetLen = len + 7; // 7: head length - let profile = 2; // 2: AAC LC - let freqIdx = 4; // 4: 44100HZ - let chanCfg = 2; // 2: 2 channel - view[0] = 0xFF; - view[1] = 0xF9; - view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2); - view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11); - view[4] = (packetLen & 0x7FF) >> 3; - view[5] = ((packetLen & 7) << 5) + 0x1F; - view[6] = 0xFC; - } - - async function stopWork(audioEncodeProcessor) { - await audioEncodeProcessor.stop().then(() => { - console.info("case stop success") - }, failCallback).catch(failCatch); - } - - async function resetWork(audioEncodeProcessor) { - resetParam(); - await audioEncodeProcessor.reset().then(async() => { - console.info("case reset success"); - if (needrelease) { - await audioEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - }, failCallback).catch(failCatch); - } - - async function flushWork(audioEncodeProcessor) { - inputQueue = []; - outputQueue = []; - await audioEncodeProcessor.flush().then(() => { - console.info("case flush at inputeos success"); - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS =true; - }, failCallback).catch(failCatch); - } - - async function doneWork(audioEncodeProcessor) { - await audioEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now();Date.now() - t <= time;); - } - - async function enqueueInputs(audioEncodeProcessor, queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - console.info("case frameCnt:" + frameCnt); - if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) { - console.info("case EOS frame separately") - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES[1]; - getContent(inputobject.data, ES[1]); - inputobject.flags = 0; - } - timestamp += 23; - frameCnt += 1; - audioEncodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueOutputs(audioEncodeProcessor, queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (stopAtEOS) { - await stopWork(audioEncodeProcessor); - } else if (resetAtEOS) { - await resetWork(audioEncodeProcessor); - } else if (flushAtEOS) { - await flushWork(audioEncodeProcessor); - } else if (workdoneAtEOS) { - await doneWork(audioEncodeProcessor); - done(); - } else { - console.info('sawOutputEOS = true'); - } - } - else{ - writeHead(savepath, outputobject.length); - writeFile(savepath, outputobject.data, outputobject.length); - console.info("write to file success"); - } - audioEncodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(audioEncodeProcessor, savepath, done) { - console.info('case callback'); - audioEncodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueInputs(audioEncodeProcessor, inputQueue); - }); - audioEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needgetMediaDes) { - audioEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needgetMediaDes=false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - await dequeueOutputs(audioEncodeProcessor, outputQueue, savepath, done); - }); - audioEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_MULTIINSTANCE_0100 - * @tc.name : 001.create multiple encoder2 - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_MULTIINSTANCE_0100', 0, async function (done) { - console.info("case test multiple encoder instances"); - let array = new Array(); - for (let i = 0; i < 2; i += 1) { - await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => { - if (typeof(processor) != 'undefined') { - console.info("case create createAudioEncoder success: " + i); - array[i] = processor; - } else { - console.info("case create createAudioEncoder failed: " + i); - } - }, failCallback).catch(failCatch); - } - console.info('case has created multiple encoders'); - for (let j = 0; j < 2; j++) { - resetParam(); - await array[j].reset().then(() => { - console.info("reset encoder " + j); - }, failCallback).catch(failCatch); - await array[j].release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - array[j] = null; - } - done(); - }) -}) - - \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityCallbackTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityCallbackTest.test.js deleted file mode 100644 index d57b46afb6f155e521f6d147459e71e2d607a30a..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityCallbackTest.test.js +++ /dev/null @@ -1,1196 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioEncoderReliabilityCallback', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/' - const AUDIOPATH = RESOURCEPATH + 'S16LE.pcm'; - const BASIC_PATH = RESOURCEPATH + 'results/encode_reliability_callback_'; - const END = 0; - const CONFIGURE = 1; - const PREPARE = 2; - const START = 3; - const FLUSH = 4; - const STOP = 5; - const RESET = 6; - const HOLDON = 7; - const WAITFORALLOUTS = 8; - const CONFIGURE_ERROR = 9; - const PREPARE_ERROR = 10; - const START_ERROR = 11; - const FLUSH_ERROR = 12; - const STOP_ERROR = 13; - const JUDGE_EOS = 14; - const WAITTIME = 3000; - let audioEncodeProcessor; - let readStreamSync; - let EOSFrameNum = 0; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needRelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - const ES_SIZE = [0, 4096]; - let ES_LENGTH = 200; - let mime = 'audio/mp4a-latm'; - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - }; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioEncodeProcessor = null; - readStreamSync = undefined; - EOSFrameNum = 0; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needRelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES_LENGTH = 200; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioEncodeProcessor != null) { - await audioEncodeProcessor.release().then(() => { - console.info('audioEncodeProcessor release success'); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - function resetParam() { - readStreamSync = undefined; - EOSFrameNum = 0; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needRelease = false; - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function createAudioEncoder(savepath, mySteps, done) { - media.createAudioEncoderByMime(mime, (err, processor) => { - expect(err).assertUndefined(); - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - setCallback(savepath, done); - console.info("case start api test"); - nextStep(mySteps, mediaDescription, done); - }) - } - - function writeHead(path, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let head = new ArrayBuffer(7); - addADTStoPacket(head, len); - let num = writestream.writeSync(head, {length:7}); - console.info(' writeSync head num = ' + num); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - - function readFile(path) { - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - function addADTStoPacket(head, len) { - let view = new Uint8Array(head) - console.info("start add ADTS to Packet"); - let packetLen = len + 7; // 7: head length - let profile = 2; // 2: AAC LC - let freqIdx = 4; // 4: 44100HZ - let chanCfg = 2; // 2: 2 channel - view[0] = 0xFF; - view[1] = 0xF9; - view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2); - view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11); - view[4] = (packetLen & 0x7FF) >> 3; - view[5] = ((packetLen & 7) << 5) + 0x1F; - view[6] = 0xFC; - } - - async function doneWork(done) { - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info("case stop success"); - resetParam(); - audioEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.log("case reset success"); - audioEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioEncodeProcessor = null; - done(); - }) - }) - }) - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - function nextStep(mySteps, mediaDescription, done) { - console.info("case myStep[0]: " + mySteps[0]); - if (mySteps[0] == END) { - audioEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.log("case release success"); - audioEncodeProcessor = null; - done(); - }) - } - switch (mySteps[0]) { - case CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - readFile(AUDIOPATH); - nextStep(mySteps, mediaDescription, done); - }); - break; - case PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - audioEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info(`case prepare 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case START: - mySteps.shift(); - console.info(`case to start`); - if (sawOutputEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - enqueueAllInputs(inputQueue); - } - audioEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info(`case start 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case FLUSH: - mySteps.shift(); - console.info(`case to flush`); - inputQueue = []; - outputQueue = []; - audioEncodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info(`case flush 1`); - if (flushAtEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - flushAtEOS = false; - } - nextStep(mySteps, mediaDescription, done); - }); - break; - case STOP: - mySteps.shift(); - console.info(`case to stop`); - audioEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`case stop 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case RESET: - mySteps.shift(); - console.info(`case to reset`); - resetParam(); - audioEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info(`case reset 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case HOLDON: - mySteps.shift(); - setTimeout(() =>{ - nextStep(mySteps, mediaDescription, done); - }, WAITTIME); - break; - case WAITFORALLOUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - case CONFIGURE_ERROR: - mySteps.shift(); - console.info(`case to configure`); - audioEncodeProcessor.configure(mediaDescription, (err) => { - expect(err != undefined).assertTrue(); - console.info(`case configure error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case PREPARE_ERROR: - mySteps.shift(); - console.info(`case to prepare`); - audioEncodeProcessor.prepare((err) => { - expect(err != undefined).assertTrue(); - console.info(`case prepare error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case START_ERROR: - mySteps.shift(); - console.info(`case to start`); - audioEncodeProcessor.start((err) => { - expect(err != undefined).assertTrue(); - console.info(`case start error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case FLUSH_ERROR: - mySteps.shift(); - console.info(`case to flush`); - audioEncodeProcessor.flush((err) => { - expect(err != undefined).assertTrue(); - console.info(`case flush error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case STOP_ERROR: - mySteps.shift(); - console.info(`case to stop`); - audioEncodeProcessor.stop((err) => { - expect(err != undefined).assertTrue(); - console.info(`case stop error 1`); - nextStep(mySteps, mediaDescription, done); - }); - break; - case JUDGE_EOS: - mySteps.shift(); - console.info(`case judge EOS state`); - expect(sawOutputEOS).assertTrue(); - nextStep(mySteps, mediaDescription, done); - break; - default: - break; - } - } - - async function enqueueAllInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - if (frameCnt == EOSFrameNum || frameCnt == ES_LENGTH + 1) { - console.info("EOS frame seperately") - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES_SIZE[1]; - getContent(inputobject.data, ES_SIZE[1]); - inputobject.flags = 0; - } - timestamp += 23; - frameCnt += 1; - audioEncodeProcessor.pushInputData(inputobject, () => { - console.info('queueInput success'); - }) - } - } - - async function dequeueAllOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (workdoneAtEOS) { - await doneWork(done); - } else { - console.info("sawOutputEOS = true"); - } - } - else{ - console.info("not last frame, continue"); - } - audioEncodeProcessor.freeOutputBuffer(outputobject, () => { - console.info('release output success'); - }) - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioEncodeProcessor.on('needInputData', async(inBuffer) => { - console.info('case inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueAllInputs(inputQueue); - }); - audioEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('case outputBufferAvailable'); - if (needGetMediaDes) { - audioEncodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - expect(err).assertUndefined(); - console.info("case get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }); - } - outputQueue.push(outBuffer); - await dequeueAllOutputs(outputQueue, savepath, done); - }); - audioEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioEncodeProcessor.on('streamChanged',(format) => { - console.info('case Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0100 - * @tc.name : 001.create -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0100.es'; - let mySteps = new Array(CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0300 - * @tc.name : 003.start -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, CONFIGURE_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0700.es'; - let mySteps = new Array(RESET, CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0800.es'; - let mySteps = new Array(CONFIGURE, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_CALLBACK_0900', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0900.es'; - let mySteps = new Array(CONFIGURE, RESET, CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0100.es'; - let mySteps = new Array(PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, PREPARE_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0100 - * @tc.name : 001.create -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0100.es'; - let mySteps = new Array(START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0200 - * @tc.name : 002.configure -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0200.es'; - let mySteps = new Array(CONFIGURE, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0400 - * @tc.name : 004.start -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0500 - * @tc.name : 005.flush -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0600 - * @tc.name : 006.stop -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, START_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0800 - * @tc.name : 008.reset -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0100 - * @tc.name : 001.create -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0100.es'; - let mySteps = new Array(FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0200.es'; - let mySteps = new Array(CONFIGURE, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0400 - * @tc.name : 004.start -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0100 - * @tc.name : 001.create -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0100.es'; - let mySteps = new Array(STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0200.es'; - let mySteps = new Array(CONFIGURE, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0400 - * @tc.name : 004.start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, STOP, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0100 - * @tc.name : 001.create -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0100.es'; - let mySteps = new Array(RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0200.es'; - let mySteps = new Array(CONFIGURE, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0400 - * @tc.name : 004.start -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_CALLBACK_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0100.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, WAITFORALLOUTS); - EOSFrameNum = 2; - flushAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, CONFIGURE, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, WAITFORALLOUTS); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_CALLBACK_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js deleted file mode 100644 index fc584e3a8cf948295d674ed170ba25e34487c240..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderReliabilityPromiseTest.test.js +++ /dev/null @@ -1,1200 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('AudioEncoderReliabilityPromise', function () { - const RESOURCEPATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioencoder/' - const AUDIOPATH = RESOURCEPATH + 'S16LE.pcm'; - const BASIC_PATH = RESOURCEPATH + 'results/encode_reliability_promise_'; - const END = 0; - const CONFIGURE = 1; - const PREPARE = 2; - const START = 3; - const FLUSH = 4; - const STOP = 5; - const RESET = 6; - const HOLDON = 7; - const WAITFORALLOUTS = 8; - const CONFIGURE_ERROR = 9; - const PREPARE_ERROR = 10; - const START_ERROR = 11; - const FLUSH_ERROR = 12; - const STOP_ERROR = 13; - const JUDGE_EOS = 14; - const WAITTIME = 3000; - let audioEncodeProcessor; - let readStreamSync; - let EOSFrameNum = 0; - let flushAtEOS = false; - let workdoneAtEOS = false; - let needGetMediaDes = false; - let needRelease = false; - let frameCnt = 1; - let timestamp = 0; - let sawInputEOS = false; - let sawOutputEOS = false; - let inputQueue = []; - let outputQueue = []; - const ES_SIZE = [0, 4096]; - let ES_LENGTH = 200; - let mime = 'audio/mp4a-latm'; - let mediaDescription = { - "channel_count": 2, - "sample_rate": 44100, - "audio_sample_format": 1, - }; - let expectError = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - audioEncodeProcessor = null; - readStreamSync = undefined; - EOSFrameNum = 0; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needRelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - ES_LENGTH = 200; - expectError = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (audioEncodeProcessor != null) { - await audioEncodeProcessor.release().then(() => { - console.info('audioEncodeProcessor release success'); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - 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(); - } - - function resetParam() { - readStreamSync = undefined; - EOSFrameNum = 0; - flushAtEOS = false; - workdoneAtEOS = false; - needGetMediaDes = false; - needRelease = false - frameCnt = 1; - timestamp = 0; - sawInputEOS = false; - sawOutputEOS = false; - inputQueue = []; - outputQueue = []; - } - - function createAudioEncoder(savepath, mySteps, done) { - media.createAudioEncoderByMime(mime).then((processor) => { - console.info(`case createAudioEncoder 1`); - audioEncodeProcessor = processor; - setCallback(savepath, done); - console.info("case start api test"); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - - function writeHead(path, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let head = new ArrayBuffer(7); - addADTStoPacket(head, len); - let num = writestream.writeSync(head, {length:7}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function writeFile(path, buf, len) { - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e); - } - } - - function readFile(path) { - try{ - console.info('filepath: ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info(e); - } - } - - function getContent(buf, len) { - console.info("case start get content"); - let lengthreal = -1; - lengthreal = readStreamSync.readSync(buf,{length:len}); - console.info('lengthreal: ' + lengthreal); - } - - function addADTStoPacket(head, len) { - let view = new Uint8Array(head); - console.info("start add ADTS to Packet"); - let packetLen = len + 7; // 7: head length - let profile = 2; // 2: AAC LC - let freqIdx = 4; // 4: 44100HZ - let chanCfg = 2; // 2: 2 channel - view[0] = 0xFF; - view[1] = 0xF9; - view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2); - view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11); - view[4] = (packetLen & 0x7FF) >> 3; - view[5] = ((packetLen & 7) << 5) + 0x1F; - view[6] = 0xFC; - } - - async function doneWork() { - await audioEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - resetParam(); - await audioEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await audioEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - audioEncodeProcessor = null; - } - - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now();Date.now() - t <= time;); - } - - function nextStep(mySteps, done) { - console.info("case myStep[0]: " + mySteps[0]); - if (mySteps[0] == END) { - audioEncodeProcessor.release().then(() => { - console.info("case release success"); - audioEncodeProcessor = null; - done(); - }, failCallback).catch(failCatch); - } - switch (mySteps[0]) { - case CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure 1`); - readFile(AUDIOPATH); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - audioEncodeProcessor.prepare().then(() => { - console.info(`case prepare 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case START: - mySteps.shift(); - console.info(`case to start`); - if (sawOutputEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - enqueueInputs(inputQueue); - } - audioEncodeProcessor.start().then(() => { - console.info(`case start 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case FLUSH: - mySteps.shift(); - console.info(`case to flush`); - inputQueue = []; - outputQueue = []; - audioEncodeProcessor.flush().then(() => { - console.info(`case flush 1`); - if (flushAtEOS) { - resetParam(); - readFile(AUDIOPATH); - workdoneAtEOS = true; - flushAtEOS = false; - } - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case STOP: - mySteps.shift(); - console.info(`case to stop`); - audioEncodeProcessor.stop().then(() => { - console.info(`case stop 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case RESET: - mySteps.shift(); - console.info(`case to reset`); - resetParam(); - audioEncodeProcessor.reset().then(() => { - console.info(`case reset 1`); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - break; - case HOLDON: - mySteps.shift(); - setTimeout(() =>{ - nextStep(mySteps, done); - }, WAITTIME); - break; - case WAITFORALLOUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - case CONFIGURE_ERROR: - mySteps.shift(); - console.info(`case to configure 2`); - audioEncodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case PREPARE_ERROR: - mySteps.shift(); - console.info(`case to prepare 2`); - audioEncodeProcessor.prepare().then(() => { - console.info(`case prepare error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case START_ERROR: - mySteps.shift(); - console.info(`case to start 2`); - audioEncodeProcessor.start().then(() => { - console.info(`case start error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case FLUSH_ERROR: - mySteps.shift(); - console.info(`case to flush 2`); - audioEncodeProcessor.flush().then(() => { - console.info(`case flush error 1`); - expect(expectError).assertTrue(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - break; - case STOP_ERROR: - mySteps.shift(); - console.info(`case to stop 2`); - audioEncodeProcessor.stop().then(() => { - console.info(`case stop error 1`); - 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, done); - break; - default: - break; - } - } - - async function enqueueInputs(queue) { - while (queue.length > 0 && !sawInputEOS) { - let inputobject = queue.shift(); - console.info("case frameCnt:" + frameCnt); - if (frameCnt == EOSFrameNum || frameCnt == ES_LENGTH + 1) { - console.info("case EOS frame seperately") - inputobject.flags = 1; - inputobject.timeMs = 0; - inputobject.length = 0; - sawInputEOS = true; - } else { - console.info("case read frame from file"); - inputobject.timeMs = timestamp; - inputobject.offset = 0; - inputobject.length = ES_SIZE[1]; - getContent(inputobject.data, ES_SIZE[1]); - inputobject.flags = 0; - } - timestamp += 23; - frameCnt += 1; - audioEncodeProcessor.pushInputData(inputobject).then(() => { - console.info('case queueInput success'); - }); - } - } - - async function dequeueOutputs(queue, savepath, done) { - while (queue.length > 0 && !sawOutputEOS) { - let outputobject = queue.shift(); - if (outputobject.flags == 1) { - sawOutputEOS = true; - if (workdoneAtEOS) { - await doneWork(); - done(); - } else { - console.info('sawOutputEOS = true'); - } - } - else{ - console.info("not last frame, continue"); - } - audioEncodeProcessor.freeOutputBuffer(outputobject).then(() => { - console.info('release output success'); - }); - } - } - - function setCallback(savepath, done) { - console.info('case callback'); - audioEncodeProcessor.on('needInputData', async(inBuffer) => { - console.info('inputBufferAvailable'); - inputQueue.push(inBuffer); - await enqueueInputs(inputQueue); - }); - audioEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (needGetMediaDes) { - audioEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes=false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - await dequeueOutputs(outputQueue, savepath, done); - }); - audioEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - audioEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0100 - * @tc.name : 001.create -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0100.es'; - let mySteps = new Array(CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0300 - * @tc.name : 003.start -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, CONFIGURE_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0700.es'; - let mySteps = new Array(RESET, CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0800.es'; - let mySteps = new Array(CONFIGURE, CONFIGURE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_CONFIGURE_PROMISE_0900', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0900.es'; - let mySteps = new Array(CONFIGURE, RESET, CONFIGURE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0100.es'; - let mySteps = new Array(PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, PREPARE_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_PREPARE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, PREPARE_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0100 - * @tc.name : 001.create -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0100.es'; - let mySteps = new Array(START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0200 - * @tc.name : 002.configure -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0200.es'; - let mySteps = new Array(CONFIGURE, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0400 - * @tc.name : 004.start -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0500 - * @tc.name : 005.flush -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0600 - * @tc.name : 006.stop -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, START_ERROR, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0800 - * @tc.name : 008.reset -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_START_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, START_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0100 - * @tc.name : 001.create -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0100.es'; - let mySteps = new Array(FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0200.es'; - let mySteps = new Array(CONFIGURE, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0400 - * @tc.name : 004.start -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, FLUSH, WAITFORALLOUTS); - workdoneAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP ,FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_FLUSH_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, FLUSH_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0100 - * @tc.name : 001.create -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0100.es'; - let mySteps = new Array(STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0200.es'; - let mySteps = new Array(CONFIGURE, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0400 - * @tc.name : 004.start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, STOP, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_STOP_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, STOP_ERROR, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0100 - * @tc.name : 001.create -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0100.es'; - let mySteps = new Array(RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0200.es'; - let mySteps = new Array(CONFIGURE, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0400 - * @tc.name : 004.start -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0600.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, STOP, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0700.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_RESET_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0800.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, RESET, RESET, END); - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0100.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0200.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, FLUSH, WAITFORALLOUTS); - EOSFrameNum = 2; - flushAtEOS = true; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0300.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, RESET, CONFIGURE, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0400.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, WAITFORALLOUTS); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_AUDIO_ENCODER_API_EOS_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0500.es'; - let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, JUDGE_EOS, STOP, START, STOP, END); - EOSFrameNum = 2; - createAudioEncoder(savepath, mySteps, done); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/List.test.js deleted file mode 100644 index 45c9bbdb7815d5788ba5ae3c4b5496c95148a5cd..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/List.test.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -require('./AudioEncoderFuncCallbackTest.test.js') -require('./AudioEncoderFuncPromiseTest.test.js') -require('./AudioEncoderReliabilityCallbackTest.test.js') -require('./AudioEncoderReliabilityPromiseTest.test.js') -require('./AudioEncoderMultiInstancesTest.test.js') \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/media/icon.png b/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/audioEncoder/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/multimedia/media/media_js_standard/videoDecoder/BUILD.gn b/multimedia/media/media_js_standard/videoDecoder/BUILD.gn deleted file mode 100644 index be6b25abd83ba672f5b3e4fe10764157e7146263..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("video_decoder_js_hap") { - hap_profile = "./src/main/config.json" - js2abc = true - deps = [ - ":video_decoder_js_assets", - ":video_decoder_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsVideoDecoderJsTest" -} -ohos_js_assets("video_decoder_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("video_decoder_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/media/media_js_standard/videoDecoder/Test.json b/multimedia/media/media_js_standard/videoDecoder/Test.json deleted file mode 100644 index 0c35c8551dfed5a5116eb34efc8f7dd6094c7f8f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/Test.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "Configuration for video decoder Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "2000000", - "package": "ohos.acts.multimedia.video.videodecoder", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsVideoDecoderJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/media/es/out_1920_1080_30fps_3s.h264 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/", - "./resource/media/es/h263_1408_1152.es ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/", - "./resource/media/es/MPEG2_720_480.es ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/", - "./resource/media/es/mpeg4_320_240.es ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/", - "./resource/media/es/out_320_240_10s.h264 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 777 -R /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder", - "chmod 777 /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/*" - ], - "teardown-command":[ - ] - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/videoDecoder/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/videoDecoder/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/config.json b/multimedia/media/media_js_standard/videoDecoder/src/main/config.json deleted file mode 100644 index 55c8b32a6cb68bdaab164fc98474746455bea8aa..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/config.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.video.videodecoder", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "iconId": 16777218, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "descriptionId": 16777217, - "visible": true, - "labelId": 16777216, - "icon": "$media:icon", - "name": "ohos.acts.multimedia.video.videodecoder.MainAbility", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "homeAbility": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "mainAbility": "ohos.acts.multimedia.video.videodecoder.MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "ohos.acts.multimedia.video.videodecoder", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index", - "pages/display/display" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/app.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/app.js deleted file mode 100644 index 830070d196d86b127cea947d168bfd116f446205..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/en-US.json b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/zh-CN.json b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.css b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.css deleted file mode 100644 index c9195944a956c0d5628c701b7a3d9d2ed525cd2d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.hml b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.hml deleted file mode 100644 index 9e58ed9e321b3f22e771122b4783b0f9f60cba2f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.hml +++ /dev/null @@ -1,26 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - - - - -
diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.js deleted file mode 100644 index 5d5b9ac7ed3e0c336cf20d8b7d2393877c91ebe5..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/display/display.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - console.info('onInit finish') - this.title = this.$t('strings.world'); - }, - onShow() { - }, - onReady() { - }, - LoadXcomponent() { - globalThis.value = this.$element('XcomponentId').getXComponentSurfaceId(); - }, -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.css b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.css deleted file mode 100644 index c3517ad1592bddda252d0f8d5a736dd41181a026..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.hml b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 8d0e2061b88c99c91488405f0f2ead0c77de1a9e..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.js deleted file mode 100644 index cfb5ff123bbbf4f57d7b111779e4b5f176a4bcec..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - console.info('onInit finish') - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - this.timeout = 60000 - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/List.test.js deleted file mode 100644 index 9c483bbcee238f77265fbadbbc5a8b82ae1b01e7..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/List.test.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -require('./VideoDecoderFuncCallbackTest.test.js') -require('./VideoDecoderFuncPromiseTest.test.js') -require('./VideoDecoderReliCallbackTest.test.js') -require('./VideoDecoderReliPromiseTest.test.js') -require('./VideoDecoderSoftwareFuncCallbackTest.test.js') -require('./VideoDecoderSoftwareFuncPromiseTest.test.js') -require('./VideoDecoderSoftwareReliCallbackTest.test.js') -require('./VideoDecoderSoftwareReliPromiseTest.test.js') -require('./VideoDecoderEnumTest.test.js') diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js deleted file mode 100644 index 0781c5ca6c3b3396bc1f7aed7fb352197fe1be87..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderEnumTest.test.js +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - - -describe('VideoDecoderEnum', function () { - let videoDecodeProcessor = null; - let videoPlayer = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let inputQueue = []; - let outputQueue = []; - let isCodecData = false; - let inputEosFlag = false; - let surfaceID = ''; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - let ES_FRAME_SIZE = []; - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465]; - beforeAll(function() { - console.info('beforeAll case'); - // getSurfaceID(); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = false; - inputEosFlag = false; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: filepath ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.error('in case readFile' + e); - } - } - - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - - function getContent(buf, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - lengthReal = readStreamSync.readSync( - buf, - {length: len} - ); - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent ' + e); - } - } - function getSurfaceID() { - let surfaceIDTest = new ArrayBuffer(20); - let readSurfaceID = Fileio.createStreamSync('/data/media/surfaceID.txt', 'rb'); - readSurfaceID.readSync(surfaceIDTest, {length: 13}); - let view2 = new Uint8Array(surfaceIDTest); - for (let i = 0; i < 13; i++) { - let value = view2[i] - 48; - surfaceID = surfaceID + '' + value; - } - console.info('in case surfaceID ' + surfaceID); - readSurfaceID.closeSync(); - } - - /* push inputbuffers into codec */ - async function enqueueInputs(inputObject) { - console.info('in case: enqueueInputs in'); - 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, 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) => { - expect(inBuffer.index !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.index: '+ inBuffer.index); - expect(inBuffer.data !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.data: '+ inBuffer.data); - expect(inBuffer.offset !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.offset: '+ inBuffer.offset); - expect(inBuffer.length !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.length: '+ inBuffer.length); - expect(inBuffer.flags !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.flags: '+ inBuffer.flags); - expect(inBuffer.timeMs !== undefined).assertTrue(); - console.info('in case: inputBufferAvailable inBuffer.timeMs: '+ inBuffer.timeMs); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - videoDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info('get outputMediaDescription : ' + MediaDescription); - }, failCallback).catch(failCatch); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - expect(err.code !== undefined).assertTrue(); - console.info('in case: err.code is ' + err.code); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - console.info('in case: setCallback out'); - } - - async function toCreateVideoDecoderByMime(mime, done) { - await media.createVideoDecoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoDecodeProcessor = processor; - console.info('in case : createVideoDecoderByMime success'); - } else { - console.info('in case : createVideoDecoderByMime fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - async function toGetVideoDecoderCaps() { - await videoDecodeProcessor.getVideoDecoderCaps().then((videoCaps) => { - console.info("case get getVideoDecoderCaps success"); - console.info("print videoCaps: " + videoCaps) - }, failCallback).catch(failCatch); - } - async function toCreateVideoDecoderByName(name, done) { - await media.createVideoDecoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoDecodeProcessor = processor; - console.info('in case : createVideoDecoderByName success'); - } else { - console.info('in case : createVideoDecoderByName fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - async function toConfigure(mediaDescription, srcPath) { - await videoDecodeProcessor.configure(mediaDescription).then(() =>{ - console.info('in case : configure success'); - readFile(srcPath); - }, failCallback).catch(failCatch); - } - async function setSurfaceID(done) { - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - videoPlayer = video; - console.info('in case : createVideoPlayer success'); - } else { - expect().assertFail(); - console.info('in case error: createVideoPlayer fail'); - done(); - } - }, failCallback).catch(failCatch); - await videoPlayer.getDisplaySurface().then((surface) => { - console.info('in case : getDisplaySurface success and surfaceID is ' + surface); - surfaceID = surface; - }, failCallback).catch(failCatch); - } - async function toSetOutputSurface(isDisplay) { - await videoDecodeProcessor.setOutputSurface(surfaceID, isDisplay).then(() => { - console.info('in case : setOutputSurface success. surfaceID ' + surfaceID); - }, failCallback).catch(failCatch); - } - eventEmitter.on('nextStep', async (done) => { - console.info('in case : nextStep success'); - await videoDecodeProcessor.stop().then(() => { - console.info('in case : stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('in case : reset success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.release().then(() => { - console.info('in case : release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - console.info('in case : done'); - done(); - }); - async function toPrepare() { - await videoDecodeProcessor.prepare().then(() => { - console.info('in case : prepare success'); - }, failCallback).catch(failCatch); - } - async function toStart() { - await videoDecodeProcessor.start().then(() => { - console.info('in case : start success'); - }, failCallback).catch(failCatch); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_ENUM_CodecBuffer_0100 - * @tc.name : 001.CodecBuffer - * @tc.desc : Test Interface CodecBuffer - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_ENUM_CodecBuffer_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByMime('video/avc', done); - await toGetVideoDecoderCaps(); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_ENUM_CodecMimeType_0100 - * @tc.name : 002.CodecMimeType - * @tc.desc : Test Enumerate CodecMimeType - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_ENUM_CodecMimeType_0100', 0, async function (done) { - expect(media.CodecMimeType.VIDEO_H263).assertEqual('video/h263'); - expect(media.CodecMimeType.VIDEO_AVC).assertEqual('video/avc'); - expect(media.CodecMimeType.VIDEO_MPEG2).assertEqual('video/mpeg2'); - expect(media.CodecMimeType.VIDEO_MPEG4).assertEqual('video/mp4v-es'); - expect(media.CodecMimeType.VIDEO_VP8).assertEqual('video/x-vnd.on2.vp8'); - done(); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncCallbackTest.test.js deleted file mode 100644 index ba22c5bb79a36e899a987167810767a23d59c827..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncCallbackTest.test.js +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('VideoDecoderFuncCallbackTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let inputQueue = []; - let outputQueue = []; - let isCodecData = false; - let inputEosFlag = false; - let surfaceID = ''; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - let ES_FRAME_SIZE = []; - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - const H263_FRAME_SIZE = - [ 96618, 3515, 4132, 4336, 4646, 3497, 4430, 5437, 7560, 4613, 4876, 4734, 53617, 4079, 4507, 5222, 6244, - 5843, 6601, 6622, 6751, 6539, 7666, 7706, 53977, 7311, 12906, 10308, 26791, 15983, 34794, 22110, 37165, - 24267, 36171, 18330, 53228, 7893, 13088, 9502, 8485, 9207, 8681, 9202, 8537, 7603, 9726, 8191, 51872, - 5535, 6146, 6341, 6933, 9365, 7828, 6547, 7638, 7009, 7025, 8873, 51045, 5056, 4858, 4887, 9614, 5953, - 5972, 6116, 6060, 6296, 6239, 6400, 50928, 4937, 5054, 5371, 6728, 6286, 6524, 6646, 6549, 6036, 6214, - 5866, 51109, 4778, 5273, 6327]; - const MPEG2_FRAME_SIZE = - [ 38462, 55096, 8660, 3417, 1197, 2209, 984, 718, 783, 623, 659, 694, 14174, 580, 421, 495, 480, 476, 534, - 660, 699, 601, 603, 720, 12585, 555, 532, 776, 789, 762, 766, 732, 671, 735, 777, 948, 12650, 827, 766, - 835, 747, 847, 940, 1121, 1092, 1001, 980, 989, 12746, 945, 912, 1046, 1118, 1134, 1050, 1073, 1051, 1195, - 1085, 1182, 12874, 992, 1007, 985, 1040, 1143, 1157, 1150, 1247, 1149, 1246, 1145, 12870, 1041, 1066, 1314, - 1239, 1283, 1223, 1224, 1270, 1427, 1406, 1516, 12949, 1228, 1299, 1439, 1358, 1455, 1311, 1396, 1416, 1470, - 1393, 1502, 12999, 1232, 1400, 1348, 1335, 1461, 1404, 1412, 1426, 1548, 1481, 1488, 12840, 1229, 1342, 1323, - 1353, 1524, 1363, 1475, 1540, 1495, 1489, 1438, 12762, 1291, 1303, 1470, 1494, 1488, 1474, 1453, 1607, 1485, - 1589, 1762, 12548, 1363, 1317, 1435, 1411, 1338, 1373, 1605, 1639, 1429, 1392, 1543, 12332, 1255, 1200, 1291, - 1337, 1341, 1356, 1214, 1456, 1353, 1314, 1502, 12151, 1192, 1290, 1203, 1284, 1154, 1264, 1358, 1390, 1433, - 1194, 1325, 11904, 993, 1007, 1149, 1099, 1182, 1076, 1074, 1092, 1030, 1272, 1178, 11710, 966, 879, 860, 955, - 898, 967, 927, 1066, 997, 1083, 940, 11717, 648, 705, 901, 925, 930, 868, 798, 846, 781, 825, 1027, 11587, 785, - 733, 731, 848, 753, 806, 699, 837, 750, 762, 748, 11541, 678, 742, 667, 735, 702, 837, 695, 773, 849, 869, 769, - 11381, 664, 705, 714, 698, 814, 846, 757, 802, 857, 905, 772, 11265, 718, 643, 597, 687, 774, 843, 747, 785, - 683, 1135, 676, 11259, 616, 595, 773, 746, 798, 722, 798, 790, 959, 771, 907, 11234, 705, 675, 773, 764, 846, - 789, 840, 853, 828, 774, 842, 11263, 758, 758, 757, 820, 847, 834, 884, 842, 988, 750, 952, 11236, 776, 640, 727, - 832, 855, 733, 822, 827, 862, 697, 924, 11176, 675, 615, 688, 818, 783, 746, 901, 834, 892, 759, 923, 11181, 661, - 578, 720, 697]; - const MPEG4_FRAME_SIZE = - [ 11895, 8109, 1578, 1616, 1313, 572, 805, 837, 755, 706, 952, 879, 13193, 422, 389, 509, 725, 465, 479, 959, - 677, 364, 541, 696, 9306, 322, 318, 767, 590, 422, 530, 403, 505, 566, 445, 508, 7783, 460, 405, 343, 451, - 608, 431, 411, 543, 487, 527, 400, 6287, 385, 418, 391, 592, 434, 412, 398, 504, 492, 479, 561, 5413, 317, - 355, 422, 467, 452, 476, 460, 490, 492, 485, 451, 5036, 312, 408, 460, 432, 502, 388, 475, 407, 544, 401, - 487, 4404, 362, 378, 427, 416, 426, 456, 414, 438, 424, 442, 444, 4310, 362, 388, 393, 390, 441, 398, 423, - 369, 443, 406, 392, 4231, 343, 363, 355, 390, 459, 371, 378, 381, 405, 392, 426, 3975, 387, 337, 393, 439, - 378, 355, 374, 484, 381, 373, 423, 3869, 312, 350, 400, 345, 356, 320, 473, 431, 386, 338, 431, 3426, 268, - 315, 416, 383, 373, 381, 354, 383, 328, 348, 418, 3715, 324, 361, 331, 350, 302, 409, 377, 359, 384, 334, - 326, 3439, 266, 324, 329, 353, 405, 303, 357, 332, 292, 361, 333, 3542, 294, 284, 247, 331, 306, 322, 287, - 367, 341, 276, 258, 3980, 246, 245, 259, 309, 333, 250, 275, 334, 281, 253, 371, 3640, 213, 231, 301, 302, - 228, 289, 290, 281, 201, 284, 277, 4242, 205, 328, 237, 283, 295, 266, 230, 321, 348, 212, 308, 4103, 259, - 238, 245, 298, 330, 265, 271, 287, 267, 286, 290, 3856, 269, 242, 209, 314, 267, 278, 280, 314, 250, 433, - 238, 3654, 195, 246, 301, 298, 250, 270, 320, 269, 305, 258, 368, 3810, 231, 212, 279, 289, 252, 303, 287, - 295, 206, 264, 349, 4071, 242, 296, 271, 231, 307, 265, 254, 267, 317, 232, 348, 4077, 259, 222, 268, 235, - 324, 266, 256, 312, 246, 248, 325, 4000, 266, 201, 230, 293, 264, 265, 273, 301, 304, 253, 266, 3978, 228, - 232, 250, 248, 281, 219, 243, 293, 287, 253, 328, 3719]; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = false; - inputEosFlag = false; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: filepath ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case error readFile' + e); - } - } - function getContent(buf, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - lengthReal = readStreamSync.readSync( - buf, - {length: len} - ); - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent: ' + e); - } - } - - /* push inputbuffers into codec */ - 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 { - console.info(`in case queueInput err called,errMessage is ${error.message}`); - } - }) - } - - /* get outputbuffers from codec */ - 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); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - videoDecodeProcessor.getOutputMediaDescription((err, MediaDescription) => { - expect(err).assertUndefined(); - console.info('get outputMediaDescription : ' + MediaDescription); - }); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - console.info('in case: setCallback out'); - } - eventEmitter.on('configure', (mediaDescription, srcPath, nextStep, done) => { - console.info('in case : configure in'); - videoDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info('in case : configure success'); - readFile(srcPath); - setCallback(nextStep); - eventEmitter.emit('getVideoDecoderCaps', done); - // eventEmitter.emit('setOutputSurface', done); - }); - }); - eventEmitter.on('getVideoDecoderCaps', (done) => { - videoDecodeProcessor.getVideoDecoderCaps((err, videoCaps) => { - expect(err).assertUndefined(); - console.info('case get getVideoDecoderCaps success'); - console.info(`print videoCaps: - codecInfo.name ${videoCaps.codecInfo.name} - codecInfo.type ${videoCaps.codecInfo.type} - codecInfo.mimeType ${videoCaps.codecInfo.mimeType} - codecInfo.isHardwareAccelerated ${videoCaps.codecInfo.isHardwareAccelerated} - codecInfo.isSoftwareOnly ${videoCaps.codecInfo.isSoftwareOnly} - codecInfo.isVendor ${videoCaps.codecInfo.isVendor} - supportedBitrate [${videoCaps.supportedBitrate.min}, ${videoCaps.supportedBitrate.max}] - supportedFormats ${videoCaps.supportedFormats} - supportedHeightAlignment ${videoCaps.supportedHeightAlignment} - supportedWidthAlignment ${videoCaps.supportedWidthAlignment} - supportedWidth [${videoCaps.supportedWidth.min}, ${videoCaps.supportedWidth.max}] - supportedHeight [${videoCaps.supportedHeight.min}, ${videoCaps.supportedHeight.max}] - supportedProfiles ${videoCaps.supportedProfiles} - supportedLevels ${videoCaps.supportedLevels} - supportedBitrateMode ${videoCaps.supportedBitrateMode} - supportedQuality [${videoCaps.supportedQuality.min}, ${videoCaps.supportedQuality.max}] - supportedComplexity [${videoCaps.supportedComplexity.min}, ${videoCaps.supportedComplexity.max}] - `); - eventEmitter.emit('setOutputSurface', done); - }); - }); - - eventEmitter.on('setOutputSurface', (done) => { - videoDecodeProcessor.setOutputSurface(surfaceID, true, (err) => { - expect(err).assertUndefined(); - console.info('in case : setOutputSurface success, surfaceID ' + surfaceID); - eventEmitter.emit('prepare', done); - }) - }); - eventEmitter.on('prepare', (done) => { - videoDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info('in case : prepare success'); - eventEmitter.emit('start', done); - }); - }); - eventEmitter.on('start', (done) => { - videoDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info('in case : start success'); - }); - }); - eventEmitter.on('stop', (done) => { - videoDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info('in case : stop success'); - eventEmitter.emit('reset', done); - }); - }); - eventEmitter.on('reset', (done) => { - videoDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info('in case : reset success'); - eventEmitter.emit('release', done); - }); - }); - eventEmitter.on('release', (done) => { - videoDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info('in case : release success'); - videoDecodeProcessor = null; - done(); - }); - }); - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_H264_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_H264_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByMime('video/avc', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByMime success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, - done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_MPEG2_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_MPEG2_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG2_FRAME_SIZE; - let srcPath = BASIC_PATH + 'MPEG2_720_480.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mpeg2', - 'width': 720, - 'height': 480, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByMime('video/mpeg2', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByMime success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, - done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_MPEG4_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_MPEG4_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG4_FRAME_SIZE; - let srcPath = BASIC_PATH + 'mpeg4_320_240.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mp4v-es', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByMime('video/mp4v-es', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByMime success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, - done); - }); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js deleted file mode 100644 index 625f4a8be225804eb5a62e6ff6390f3d5cd67856..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderFuncPromiseTest.test.js +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - - -describe('VideoDecoderFuncPromiseTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let inputQueue = []; - let outputQueue = []; - let isCodecData = false; - let inputEosFlag = false; - let surfaceID = ''; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - let ES_FRAME_SIZE = []; - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - const H263_FRAME_SIZE = - [ 96618, 3515, 4132, 4336, 4646, 3497, 4430, 5437, 7560, 4613, 4876, 4734, 53617, 4079, 4507, 5222, 6244, - 5843, 6601, 6622, 6751, 6539, 7666, 7706, 53977, 7311, 12906, 10308, 26791, 15983, 34794, 22110, 37165, - 24267, 36171, 18330, 53228, 7893, 13088, 9502, 8485, 9207, 8681, 9202, 8537, 7603, 9726, 8191, 51872, - 5535, 6146, 6341, 6933, 9365, 7828, 6547, 7638, 7009, 7025, 8873, 51045, 5056, 4858, 4887, 9614, 5953, - 5972, 6116, 6060, 6296, 6239, 6400, 50928, 4937, 5054, 5371, 6728, 6286, 6524, 6646, 6549, 6036, 6214, - 5866, 51109, 4778, 5273, 6327]; - const MPEG2_FRAME_SIZE = - [ 38462, 55096, 8660, 3417, 1197, 2209, 984, 718, 783, 623, 659, 694, 14174, 580, 421, 495, 480, 476, 534, - 660, 699, 601, 603, 720, 12585, 555, 532, 776, 789, 762, 766, 732, 671, 735, 777, 948, 12650, 827, 766, - 835, 747, 847, 940, 1121, 1092, 1001, 980, 989, 12746, 945, 912, 1046, 1118, 1134, 1050, 1073, 1051, 1195, - 1085, 1182, 12874, 992, 1007, 985, 1040, 1143, 1157, 1150, 1247, 1149, 1246, 1145, 12870, 1041, 1066, 1314, - 1239, 1283, 1223, 1224, 1270, 1427, 1406, 1516, 12949, 1228, 1299, 1439, 1358, 1455, 1311, 1396, 1416, 1470, - 1393, 1502, 12999, 1232, 1400, 1348, 1335, 1461, 1404, 1412, 1426, 1548, 1481, 1488, 12840, 1229, 1342, 1323, - 1353, 1524, 1363, 1475, 1540, 1495, 1489, 1438, 12762, 1291, 1303, 1470, 1494, 1488, 1474, 1453, 1607, 1485, - 1589, 1762, 12548, 1363, 1317, 1435, 1411, 1338, 1373, 1605, 1639, 1429, 1392, 1543, 12332, 1255, 1200, 1291, - 1337, 1341, 1356, 1214, 1456, 1353, 1314, 1502, 12151, 1192, 1290, 1203, 1284, 1154, 1264, 1358, 1390, 1433, - 1194, 1325, 11904, 993, 1007, 1149, 1099, 1182, 1076, 1074, 1092, 1030, 1272, 1178, 11710, 966, 879, 860, 955, - 898, 967, 927, 1066, 997, 1083, 940, 11717, 648, 705, 901, 925, 930, 868, 798, 846, 781, 825, 1027, 11587, 785, - 733, 731, 848, 753, 806, 699, 837, 750, 762, 748, 11541, 678, 742, 667, 735, 702, 837, 695, 773, 849, 869, 769, - 11381, 664, 705, 714, 698, 814, 846, 757, 802, 857, 905, 772, 11265, 718, 643, 597, 687, 774, 843, 747, 785, - 683, 1135, 676, 11259, 616, 595, 773, 746, 798, 722, 798, 790, 959, 771, 907, 11234, 705, 675, 773, 764, 846, - 789, 840, 853, 828, 774, 842, 11263, 758, 758, 757, 820, 847, 834, 884, 842, 988, 750, 952, 11236, 776, 640, 727, - 832, 855, 733, 822, 827, 862, 697, 924, 11176, 675, 615, 688, 818, 783, 746, 901, 834, 892, 759, 923, 11181, 661, - 578, 720, 697]; - const MPEG4_FRAME_SIZE = - [ 11895, 8109, 1578, 1616, 1313, 572, 805, 837, 755, 706, 952, 879, 13193, 422, 389, 509, 725, 465, 479, 959, - 677, 364, 541, 696, 9306, 322, 318, 767, 590, 422, 530, 403, 505, 566, 445, 508, 7783, 460, 405, 343, 451, - 608, 431, 411, 543, 487, 527, 400, 6287, 385, 418, 391, 592, 434, 412, 398, 504, 492, 479, 561, 5413, 317, - 355, 422, 467, 452, 476, 460, 490, 492, 485, 451, 5036, 312, 408, 460, 432, 502, 388, 475, 407, 544, 401, - 487, 4404, 362, 378, 427, 416, 426, 456, 414, 438, 424, 442, 444, 4310, 362, 388, 393, 390, 441, 398, 423, - 369, 443, 406, 392, 4231, 343, 363, 355, 390, 459, 371, 378, 381, 405, 392, 426, 3975, 387, 337, 393, 439, - 378, 355, 374, 484, 381, 373, 423, 3869, 312, 350, 400, 345, 356, 320, 473, 431, 386, 338, 431, 3426, 268, - 315, 416, 383, 373, 381, 354, 383, 328, 348, 418, 3715, 324, 361, 331, 350, 302, 409, 377, 359, 384, 334, - 326, 3439, 266, 324, 329, 353, 405, 303, 357, 332, 292, 361, 333, 3542, 294, 284, 247, 331, 306, 322, 287, - 367, 341, 276, 258, 3980, 246, 245, 259, 309, 333, 250, 275, 334, 281, 253, 371, 3640, 213, 231, 301, 302, - 228, 289, 290, 281, 201, 284, 277, 4242, 205, 328, 237, 283, 295, 266, 230, 321, 348, 212, 308, 4103, 259, - 238, 245, 298, 330, 265, 271, 287, 267, 286, 290, 3856, 269, 242, 209, 314, 267, 278, 280, 314, 250, 433, - 238, 3654, 195, 246, 301, 298, 250, 270, 320, 269, 305, 258, 368, 3810, 231, 212, 279, 289, 252, 303, 287, - 295, 206, 264, 349, 4071, 242, 296, 271, 231, 307, 265, 254, 267, 317, 232, 348, 4077, 259, 222, 268, 235, - 324, 266, 256, 312, 246, 248, 325, 4000, 266, 201, 230, 293, 264, 265, 273, 301, 304, 253, 266, 3978, 228, - 232, 250, 248, 281, 219, 243, 293, 287, 253, 328, 3719]; - beforeAll(function() { - console.info('beforeAll case'); - // getSurfaceID(); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = false; - inputEosFlag = false; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: filepath ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.error('in case readFile' + e); - } - } - - function getContent(buf, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - lengthReal = readStreamSync.readSync( - buf, - {length: len} - ); - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent ' + e); - } - } - function getSurfaceID() { - let surfaceIDTest = new ArrayBuffer(20); - let readSurfaceID = Fileio.createStreamSync('/data/media/surfaceID.txt', 'rb'); - readSurfaceID.readSync(surfaceIDTest, {length: 13}); - let view2 = new Uint8Array(surfaceIDTest); - for (let i = 0; i < 13; i++) { - let value = view2[i] - 48; - surfaceID = surfaceID + '' + value; - } - console.info('in case surfaceID ' + surfaceID); - readSurfaceID.closeSync(); - } - - /* push inputbuffers into codec */ - 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, 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); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - videoDecodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info('get outputMediaDescription : ' + MediaDescription); - }, failCallback).catch(failCatch); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - console.info('in case: setCallback out'); - } - - async function toCreateVideoDecoderByMime(mime, done) { - await media.createVideoDecoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoDecodeProcessor = processor; - console.info('in case : createVideoDecoderByMime success'); - } else { - console.info('in case : createVideoDecoderByMime fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - async function toGetVideoDecoderCaps() { - await videoDecodeProcessor.getVideoDecoderCaps().then((videoCaps) => { - console.info("case get getVideoDecoderCaps success"); - console.info(`print videoCaps: - codecInfo.name ${videoCaps.codecInfo.name} - codecInfo.type ${videoCaps.codecInfo.type} - codecInfo.mimeType ${videoCaps.codecInfo.mimeType} - codecInfo.isHardwareAccelerated ${videoCaps.codecInfo.isHardwareAccelerated} - codecInfo.isSoftwareOnly ${videoCaps.codecInfo.isSoftwareOnly} - codecInfo.isVendor ${videoCaps.codecInfo.isVendor} - supportedBitrate [${videoCaps.supportedBitrate.min}, ${videoCaps.supportedBitrate.max}] - supportedFormats ${videoCaps.supportedFormats} - supportedHeightAlignment ${videoCaps.supportedHeightAlignment} - supportedWidthAlignment ${videoCaps.supportedWidthAlignment} - supportedWidth [${videoCaps.supportedWidth.min}, ${videoCaps.supportedWidth.max}] - supportedHeight [${videoCaps.supportedHeight.min}, ${videoCaps.supportedHeight.max}] - supportedProfiles ${videoCaps.supportedProfiles} - supportedLevels ${videoCaps.supportedLevels} - supportedBitrateMode ${videoCaps.supportedBitrateMode} - supportedQuality [${videoCaps.supportedQuality.min}, ${videoCaps.supportedQuality.max}] - supportedComplexity [${videoCaps.supportedComplexity.min}, ${videoCaps.supportedComplexity.max}] - `); - }, failCallback).catch(failCatch); - } - async function toConfigure(mediaDescription, srcPath) { - await videoDecodeProcessor.configure(mediaDescription).then(() =>{ - console.info('in case : configure success'); - readFile(srcPath); - }, failCallback).catch(failCatch); - } - async function toSetOutputSurface(isDisplay) { - await videoDecodeProcessor.setOutputSurface(surfaceID, isDisplay).then(() => { - console.info('in case : setOutputSurface success. surfaceID ' + surfaceID); - }, failCallback).catch(failCatch); - } - eventEmitter.on('nextStep', async (done) => { - console.info('in case : nextStep success'); - await videoDecodeProcessor.stop().then(() => { - console.info('in case : stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('in case : reset success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.release().then(() => { - console.info('in case : release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - console.info('in case : done'); - done(); - }); - async function toPrepare() { - await videoDecodeProcessor.prepare().then(() => { - console.info('in case : prepare success'); - }, failCallback).catch(failCatch); - } - async function toStart() { - await videoDecodeProcessor.start().then(() => { - console.info('in case : start success'); - }, failCallback).catch(failCatch); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_H264_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_H264_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByMime('video/avc', done); - await toGetVideoDecoderCaps(); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_MPEG2_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_MPEG2_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG2_FRAME_SIZE; - let srcPath = BASIC_PATH + 'MPEG2_720_480.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mpeg2', - 'width': 720, - 'height': 480, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByMime('video/mpeg2', done); - await toGetVideoDecoderCaps(); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_MPEG4_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_MPEG4_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG4_FRAME_SIZE; - let srcPath = BASIC_PATH + 'mpeg4_320_240.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mp4v-es', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByMime('video/mp4v-es', done); - await toGetVideoDecoderCaps(); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_MULTIINSTANCE_PROMISE_0100 - * @tc.name : 001.creat multiple video decoders - * @tc.desc : creat multiple video decoders - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_MULTIINSTANCE_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - let array = new Array(); - eventEmitter.on('releaseAllDecoder', async () => { - for (let j = 0; j < 2; j++) { - await array[j].release().then(() => { - array[j] = null; - }, failCallback).catch(failCatch); - } - await videoDecodeProcessor.release().then(() => { - console.info('in case : release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - done(); - }) - for (let i = 0; i < 3; i++) { - await media.createVideoDecoderByMime('video/avc').then((processor) => { - if (typeof (processor) != 'undefined') { - console.info('in case : createVideoDecoderByMime success'); - if (i == 2) { - videoDecodeProcessor = processor; - } else { - array[i] = processor; - } - } else { - console.info('in case : createVideoDecoderByMime fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('releaseAllDecoder', done);} - ); - await toPrepare(); - await toStart(); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliCallbackTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliCallbackTest.test.js deleted file mode 100644 index 3acec6a91b2aff17af40ccb0d7cbcd51bcc0af79..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliCallbackTest.test.js +++ /dev/null @@ -1,1277 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -export -const DECODE_STEP = { - WAIT_FOR_EOS : 'waitForEOS', - CONFIGURE : 'configure', - SETSURFACE : 'setSurface', - PREPARE : 'prepare', - START : 'start', - FLUSH : 'flush', - STOP : 'stop', - RESET : 'reset', - WAIT_FOR_ALL_OUTS : 'waitForAllOuts', - ERROR : 'error', - RELEASE : 'release', -} - -describe('VideoDecoderReliCallbackTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let position = 0; - let eosFrameId = -1; - let inputQueue = []; - let outputQueue = []; - let isCodecData = true; - let inputEosFlag = false; - let workdoneAtEOS = false; - let surfaceID = ''; - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - const SRCPATH = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60, - 'max_input_size': 150000, - } - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - let ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - workdoneAtEOS = false; - eosFrameId = -1; - inputEosFlag = false; - position = 0; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - function printError(err, expectFail) { - expect((err != undefined) == expectFail).assertTrue(); - if (expectFail == false && err != undefined) { - console.info('in case error failCatch called,err is ' + err); - console.info(`in case error failCatch called,errMessage is ${err.message}`); - } - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: file path ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case readFile' + e); - } - } - - function getContent(buf, pos, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - if (pos == -1) { - lengthReal = readStreamSync.readSync(buf, { - length: len, - }); - } else { - lengthReal = readStreamSync.readSync(buf, { - length: len, - position: pos, - }); - } - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent err ' + err); - } - } - - /* push inputbuffers into codec */ - 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, outputObject) { - if (outputObject.flags == 1 ) { - if (workdoneAtEOS) { - doneWork(nextStep); - } - return; - } - frameCountOut++; - videoDecodeProcessor.freeOutputBuffer(outputObject, () => { - console.log('in case: release output count:' + frameCountOut); - }) - } - - function toConfigure(mySteps, done, expectFail) { - videoDecodeProcessor.configure(mediaDescription, (err) => { - console.info(`case configure callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }) - } - function toPrepare(mySteps, done, expectFail) { - videoDecodeProcessor.prepare((err) => { - console.info(`case prepare callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toStart(mySteps, done, expectFail) { - let timeDelay = 0; - videoDecodeProcessor.start((err) => { - console.info(`case start callback`); - printError(err, expectFail); - if (mySteps[0] == DECODE_STEP.FLUSH) { - timeDelay = 500; - } - setTimeout(() => { - toNextStep(mySteps, done); - }, timeDelay); - }); - } - function toFlush(mySteps, done, expectFail) { - videoDecodeProcessor.flush((err) => { - console.info(`case flush callback`); - printError(err, expectFail); - if (expectFail == false) { - inputEosFlag = false; - position = ES_FRAME_SIZE[0]; - inputQueue = []; - timestamp = 0; - frameCountIn = 1; - } - toNextStep(mySteps, done); - }); - } - function toStop(mySteps, done, expectFail) { - videoDecodeProcessor.stop((err) => { - console.info(`case stop callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toReset(mySteps, done, expectFail) { - videoDecodeProcessor.reset((err) => { - console.info(`case reset callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toSetOutputSurface(mySteps, done, expectFail) { - videoDecodeProcessor.setOutputSurface(surfaceID, true, (err) => { - console.info('case setOutputSurface callback, surfaceID ' + surfaceID); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toNextStep(mySteps, done) { - console.info('case myStep[0]: ' + mySteps[0]); - if (mySteps[0] == DECODE_STEP.RELEASE) { - if (videoDecodeProcessor != null){ - videoDecodeProcessor.release((err) => { - printError(err, false); - console.info('in case : videoDecodeProcessor release callback'); - videoDecodeProcessor = null; - console.info('case to done'); - done(); - }); - } - return; - } - switch (mySteps[0]) { - case DECODE_STEP.CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toConfigure(mySteps, done, true); - } else { - toConfigure(mySteps, done, false); - } - break; - case DECODE_STEP.SETSURFACE: - mySteps.shift(); - console.info(`case to setOutputSurface`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toSetOutputSurface(mySteps, done, true); - } else { - toSetOutputSurface(mySteps, done, false); - } - break; - case DECODE_STEP.PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toPrepare(mySteps, done, true); - } else { - toPrepare(mySteps, done, false); - } - break; - case DECODE_STEP.START: - mySteps.shift(); - console.info(`case to start`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStart(mySteps, done, true); - } else { - readStreamSync = undefined; - readFile(SRCPATH); - frameCountIn = 0; - frameCountOut = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - position = 0; - toStart(mySteps, done, false); - } - break; - case DECODE_STEP.FLUSH: - mySteps.shift(); - console.info(`case to flush`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toFlush(mySteps, done, true); - } else { - toFlush(mySteps, done, false); - } - break; - case DECODE_STEP.STOP: - mySteps.shift(); - console.info(`case to stop`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStop(mySteps, done, true); - } else { - toStop(mySteps, done, false); - } - break; - case DECODE_STEP.RESET: - mySteps.shift(); - console.info(`case to reset`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toReset(mySteps, done, true); - } else { - toReset(mySteps, done, false); - } - break; - case DECODE_STEP.WAIT_FOR_EOS: - mySteps.shift(); - setTimeout(() =>{ - expect(inputEosFlag).assertTrue(); - if (inputEosFlag == false) { - console.info(`in case error wait for eos: inputEosFlag = false`); - } - toNextStep(mySteps, done); - }, 7000); // wait 7000 ms for eos - break; - case DECODE_STEP.WAIT_FOR_ALL_OUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - default: - break; - } - } - - function setCallback(nextStep){ - videoDecodeProcessor.on('needInputData', async (inBuffer) => { - console.info('in case: inputBufferAvailable inBuffer.index: '+ inBuffer.index); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - } - - function toCreateVideoDecoderByMime(mime, mySteps, done) { - media.createVideoDecoderByMime(mime, (err, processor) => { - console.info(`case createVideoDecoderByMime callback`); - printError(err, false); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }) - } - function toCreateVideoDecoderByName(name, mySteps, done) { - media.createVideoDecoderByName(name, (err, processor) => { - printError(err, false); - console.info(`case createVideoDecoderByName callback`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }) - } - async function doneWork(nextStep) { - videoDecodeProcessor.stop((err) => { - printError(err, false); - console.info('case stop callback'); - videoDecodeProcessor.reset((err) => { - printError(err, false); - console.info('case reset callback'); - videoDecodeProcessor.release((err) => { - printError(err, false); - console.info('case release callback'); - videoDecodeProcessor = null; - nextStep(); - }) - }) - }) - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0100 - * @tc.name : test set EOS manually before last frame and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0200 - * @tc.name : test flush at running state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0300 - * @tc.name : test flush at EOS state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - eosFrameId = 50; - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0400 - * @tc.name : test stop at running state and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0500 - * @tc.name : test stop and restart - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0100 - * @tc.name : 001.create -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0300 - * @tc.name : 003.start -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_CALLBACK_0900', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS , - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0100 - * @tc.name : 001.create -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0200 - * @tc.name : 002.configure -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0400 - * @tc.name : 004.start -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0500 - * @tc.name : 005.flush -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0600 - * @tc.name : 006.stop -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.START, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0800 - * @tc.name : 008.reset -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0100 - * @tc.name : 001.create -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.FLUSH, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0400 - * @tc.name : 004.start -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP , DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0100 - * @tc.name : 001.create -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.STOP, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0400 - * @tc.name : 004.start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0100 - * @tc.name : 001.create -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.RESET, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0400 - * @tc.name : 004.start -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) -}) diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliPromiseTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliPromiseTest.test.js deleted file mode 100644 index 8fa0d2eebbae0170066302ae961dda82d88a492b..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderReliPromiseTest.test.js +++ /dev/null @@ -1,1268 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -export -const DECODE_STEP = { - WAIT_FOR_EOS : 'waitForEOS', - CONFIGURE : 'configure', - SETSURFACE : 'setSurface', - PREPARE : 'prepare', - START : 'start', - FLUSH : 'flush', - STOP : 'stop', - RESET : 'reset', - WAIT_FOR_ALL_OUTS : 'waitForAllOuts', - ERROR : 'error', - RELEASE : 'release', -} - -describe('VideoDecoderReliPromiseTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let position = 0; - let eosFrameId = -1; - let inputQueue = []; - let outputQueue = []; - let isCodecData = true; - let inputEosFlag = false; - let workdoneAtEOS = false; - let surfaceID = ''; - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - const SRCPATH = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 4, - 'frame_rate': 60, - 'max_input_size': 150000, - } - const H264_FRAME_SIZE_60FPS_320 = - [2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - let ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - workdoneAtEOS = false; - eosFrameId = -1; - inputEosFlag = false; - position = 0; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let caseCallback = function(err) { - console.info(`in case caseCallback called, caseMessage is ${err.message}`); - } - let failCallback = function(err) { - console.error(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - console.error(`in case error failCatch called,errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let callbackExpectOK = function(err, mySteps, done) { - console.error(`in case error callbackExpectOK called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - toNextStep(mySteps, done); - } - let callbackExpectFail = function(err, mySteps, done) { - console.info(`in case callbackExpectFail called, errMessage is ${err.message}`); - expect(err != undefined).assertTrue(); - toNextStep(mySteps, done); - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: file path ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case readFile' + e); - } - } - - function getContent(buf, pos, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - if (pos == -1) { - lengthReal = readStreamSync.readSync(buf, { - length: len, - }); - } else { - lengthReal = readStreamSync.readSync(buf, { - length: len, - position: pos, - }); - } - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent err ' + err); - } - } - /* push inputbuffers into codec */ - 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, outputObject) { - if (outputObject.flags == 1 ) { - if (workdoneAtEOS) { - await doneWork(); - nextStep(); - } - 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) { - videoDecodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toPrepare(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.prepare().then(() => { - console.info(`case prepare success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toStart(mySteps, done, failureCallback, catchCallback) { - let timeDelay = 0; - videoDecodeProcessor.start().then(() => { - console.info(`case start success`); - if (mySteps[0] == DECODE_STEP.FLUSH) { - timeDelay = 500; - } - setTimeout(() => { - toNextStep(mySteps, done); - }, timeDelay); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toFlush(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.flush().then(() => { - console.info(`case flush success`); - position = ES_FRAME_SIZE[0]; - inputQueue = []; - timestamp = 0; - inputEosFlag = false; - frameCountIn = 1; - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toStop(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.stop().then(() => { - console.info(`case stop success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toReset(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.reset().then(() => { - console.info(`case reset success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toSetOutputSurface(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.setOutputSurface(surfaceID, true).then(() => { - console.info('in case : setOutputSurface success, surfaceID ' + surfaceID); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toNextStep(mySteps, done) { - console.info('case myStep[0]: ' + mySteps[0]); - if (mySteps[0] == DECODE_STEP.RELEASE) { - if (videoDecodeProcessor != null) { - videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - videoDecodeProcessor = null; - console.info('case to done'); - done(); - }, failCallback).catch(failCatch); - } - return; - } - switch (mySteps[0]) { - case DECODE_STEP.CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toConfigure(mySteps, done, callbackExpectFail, failCatch); - } else { - toConfigure(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.SETSURFACE: - mySteps.shift(); - console.info(`case to setOutputSurface`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toSetOutputSurface(mySteps, done, callbackExpectFail, failCatch); - } else { - toSetOutputSurface(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toPrepare(mySteps, done, callbackExpectFail, failCatch); - } else { - toPrepare(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.START: - mySteps.shift(); - console.info(`case to start`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStart(mySteps, done, callbackExpectFail, failCatch); - } else { - readStreamSync = undefined; - readFile(SRCPATH); - frameCountIn = 0; - frameCountOut = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - position = 0; - toStart(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.FLUSH: - mySteps.shift(); - console.info(`case to flush`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toFlush(mySteps, done, callbackExpectFail, failCatch); - } else { - toFlush(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.STOP: - mySteps.shift(); - console.info(`case to stop`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStop(mySteps, done, callbackExpectFail, failCatch); - } else { - toStop(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.RESET: - mySteps.shift(); - console.info(`case to reset`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toReset(mySteps, done, callbackExpectFail, failCatch); - } else { - toReset(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.WAIT_FOR_EOS: - mySteps.shift(); - setTimeout(() =>{ - expect(inputEosFlag).assertTrue(); - if (inputEosFlag == false) { - console.info(`in case error inputEosFlag == false`); - } - toNextStep(mySteps, done); - }, 7000); // wait 7000 ms for eos - break; - case DECODE_STEP.WAIT_FOR_ALL_OUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - default: - break; - } - } - - function setCallback(nextStep){ - videoDecodeProcessor.on('needInputData', async (inBuffer) => { - console.info('in case: inputBufferAvailable inBuffer.index: '+ inBuffer.index); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged', (format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - } - - function toCreateVideoDecoderByMime(mime, mySteps, done) { - media.createVideoDecoderByMime(mime).then((processor) => { - console.info(`case createVideoDecoderByMime success`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - function toCreateVideoDecoderByName(name, mySteps, done) { - media.createVideoDecoderByName(name).then((processor) => { - console.info(`case createVideoDecoderByName success`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - async function doneWork() { - await videoDecodeProcessor.stop().then(() => { - console.info('case stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('case reset success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.release().then(() => { - console.info('case release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0100 - * @tc.name : test set EOS manually before last frame and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0200 - * @tc.name : test flush at running state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0300 - * @tc.name : test flush at EOS state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - eosFrameId = 50; - workdoneAtEOS = true; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0400 - * @tc.name : test stop at running state and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0500 - * @tc.name : test stop and restart - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_FUNCTION_PROMISE_01_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0100 - * @tc.name : 001.create -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0300 - * @tc.name : 003.start -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_CONFIGURE_PROMISE_0900', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS , - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_PREPARE_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0100 - * @tc.name : 001.create -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0200 - * @tc.name : 002.configure -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0400 - * @tc.name : 004.start -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0500 - * @tc.name : 005.flush -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0600 - * @tc.name : 006.stop -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.START, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0800 - * @tc.name : 008.reset -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_START_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0100 - * @tc.name : 001.create -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.FLUSH, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0400 - * @tc.name : 004.start -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP , DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_FLUSH_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0100 - * @tc.name : 001.create -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.STOP, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0400 - * @tc.name : 004.start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_STOP_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0100 - * @tc.name : 001.create -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.RESET, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0400 - * @tc.name : 004.start -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_RESET_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_DECODER_API_EOS_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByMime('video/avc', mySteps, done); - }) -}) diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js deleted file mode 100644 index 56e16842d8eba256a77c0482d8ed00cd3b4f9771..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncCallbackTest.test.js +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('VideoDecoderFuncCallbackTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let inputQueue = []; - let outputQueue = []; - let isCodecData = false; - let inputEosFlag = false; - let surfaceID = ''; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - let ES_FRAME_SIZE = []; - const H264_FRAME_SIZE_240 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124, - 2049, 180, 122, 128, 1334, 143, 128, 1379, 116, 1884, 149, 122, 150, 1962, 176, 122, 122, 1197, 139, - 1853, 184, 151, 148, 1692, 209, 129, 126, 1736, 149, 135, 104, 1775, 165, 160, 121, 1653, 163, 123, - 112, 1907, 181, 129, 107, 1808, 177, 125, 111, 2405, 166, 144, 114, 1833, 198, 136, 113, 1960, 206, - 139, 116, 1791, 175, 130, 129, 1909, 194, 138, 119, 1807, 160, 156, 124, 1998, 184, 173, 114, 2069, 181, - 127, 139, 2212, 182, 138, 146, 1993, 214, 135, 139, 2286, 194, 137, 120, 2090, 196, 159, 132, 2294, 194, - 148, 137, 2312, 183, 163, 106, 2118, 201, 158, 127, 2291, 187, 144, 116, 2413, 139, 115, 2148, 178, 122, - 103, 2370, 207, 161, 117, 2291, 213, 159, 129, 2244, 243, 157, 133, 2418, 255, 171, 127, 2316, 185, 160, - 132, 2405, 220, 165, 155, 2539, 219, 172, 128, 2433, 199, 154, 119, 1681, 140, 1960, 143, 2682, 202, 153, - 127, 2794, 239, 158, 155, 2643, 229, 172, 125, 2526, 201, 181, 159, 2554, 233, 167, 125, 2809, 205, 164, - 117, 2707, 221, 156, 138, 2922, 240, 160, 146, 2952, 267, 177, 149, 3339, 271, 175, 136, 3006, 242, 168, - 141, 3068, 232, 194, 149, 2760, 214, 208, 143, 2811, 218, 184, 149, 137, 15486, 2116, 235, 167, 157, 2894, - 305, 184, 139, 3090, 345, 179, 155, 3226, 347, 160, 164, 3275, 321, 184, 174, 3240, 269, 166, 170, 3773, - 265, 169, 155, 3023, 301, 188, 161, 3343, 275, 174, 155, 3526, 309, 177, 173, 3546, 307, 183, 149, 3648, - 295, 213, 170, 3568, 305, 198, 166, 3641, 297, 172, 148, 3608, 301, 200, 159, 3693, 322, 209, 166, 3453, - 318, 206, 162, 3696, 341, 200, 176, 3386, 320, 192, 176, 3903, 373, 207, 187, 3305, 361, 200, 202, 3110, - 367, 220, 197, 2357, 332, 196, 201, 1827, 377, 187, 199, 860, 472, 173, 223, 238]; - const H263_FRAME_SIZE = - [ 96618, 3515, 4132, 4336, 4646, 3497, 4430, 5437, 7560, 4613, 4876, 4734, 53617, 4079, 4507, 5222, 6244, - 5843, 6601, 6622, 6751, 6539, 7666, 7706, 53977, 7311, 12906, 10308, 26791, 15983, 34794, 22110, 37165, - 24267, 36171, 18330, 53228, 7893, 13088, 9502, 8485, 9207, 8681, 9202, 8537, 7603, 9726, 8191, 51872, - 5535, 6146, 6341, 6933, 9365, 7828, 6547, 7638, 7009, 7025, 8873, 51045, 5056, 4858, 4887, 9614, 5953, - 5972, 6116, 6060, 6296, 6239, 6400, 50928, 4937, 5054, 5371, 6728, 6286, 6524, 6646, 6549, 6036, 6214, - 5866, 51109, 4778, 5273, 6327]; - const MPEG2_FRAME_SIZE = - [ 38462, 55096, 8660, 3417, 1197, 2209, 984, 718, 783, 623, 659, 694, 14174, 580, 421, 495, 480, 476, 534, - 660, 699, 601, 603, 720, 12585, 555, 532, 776, 789, 762, 766, 732, 671, 735, 777, 948, 12650, 827, 766, - 835, 747, 847, 940, 1121, 1092, 1001, 980, 989, 12746, 945, 912, 1046, 1118, 1134, 1050, 1073, 1051, 1195, - 1085, 1182, 12874, 992, 1007, 985, 1040, 1143, 1157, 1150, 1247, 1149, 1246, 1145, 12870, 1041, 1066, 1314, - 1239, 1283, 1223, 1224, 1270, 1427, 1406, 1516, 12949, 1228, 1299, 1439, 1358, 1455, 1311, 1396, 1416, 1470, - 1393, 1502, 12999, 1232, 1400, 1348, 1335, 1461, 1404, 1412, 1426, 1548, 1481, 1488, 12840, 1229, 1342, 1323, - 1353, 1524, 1363, 1475, 1540, 1495, 1489, 1438, 12762, 1291, 1303, 1470, 1494, 1488, 1474, 1453, 1607, 1485, - 1589, 1762, 12548, 1363, 1317, 1435, 1411, 1338, 1373, 1605, 1639, 1429, 1392, 1543, 12332, 1255, 1200, 1291, - 1337, 1341, 1356, 1214, 1456, 1353, 1314, 1502, 12151, 1192, 1290, 1203, 1284, 1154, 1264, 1358, 1390, 1433, - 1194, 1325, 11904, 993, 1007, 1149, 1099, 1182, 1076, 1074, 1092, 1030, 1272, 1178, 11710, 966, 879, 860, 955, - 898, 967, 927, 1066, 997, 1083, 940, 11717, 648, 705, 901, 925, 930, 868, 798, 846, 781, 825, 1027, 11587, 785, - 733, 731, 848, 753, 806, 699, 837, 750, 762, 748, 11541, 678, 742, 667, 735, 702, 837, 695, 773, 849, 869, 769, - 11381, 664, 705, 714, 698, 814, 846, 757, 802, 857, 905, 772, 11265, 718, 643, 597, 687, 774, 843, 747, 785, - 683, 1135, 676, 11259, 616, 595, 773, 746, 798, 722, 798, 790, 959, 771, 907, 11234, 705, 675, 773, 764, 846, - 789, 840, 853, 828, 774, 842, 11263, 758, 758, 757, 820, 847, 834, 884, 842, 988, 750, 952, 11236, 776, 640, 727, - 832, 855, 733, 822, 827, 862, 697, 924, 11176, 675, 615, 688, 818, 783, 746, 901, 834, 892, 759, 923, 11181, 661, - 578, 720, 697]; - const MPEG4_FRAME_SIZE = - [ 11895, 8109, 1578, 1616, 1313, 572, 805, 837, 755, 706, 952, 879, 13193, 422, 389, 509, 725, 465, 479, 959, - 677, 364, 541, 696, 9306, 322, 318, 767, 590, 422, 530, 403, 505, 566, 445, 508, 7783, 460, 405, 343, 451, - 608, 431, 411, 543, 487, 527, 400, 6287, 385, 418, 391, 592, 434, 412, 398, 504, 492, 479, 561, 5413, 317, - 355, 422, 467, 452, 476, 460, 490, 492, 485, 451, 5036, 312, 408, 460, 432, 502, 388, 475, 407, 544, 401, - 487, 4404, 362, 378, 427, 416, 426, 456, 414, 438, 424, 442, 444, 4310, 362, 388, 393, 390, 441, 398, 423, - 369, 443, 406, 392, 4231, 343, 363, 355, 390, 459, 371, 378, 381, 405, 392, 426, 3975, 387, 337, 393, 439, - 378, 355, 374, 484, 381, 373, 423, 3869, 312, 350, 400, 345, 356, 320, 473, 431, 386, 338, 431, 3426, 268, - 315, 416, 383, 373, 381, 354, 383, 328, 348, 418, 3715, 324, 361, 331, 350, 302, 409, 377, 359, 384, 334, - 326, 3439, 266, 324, 329, 353, 405, 303, 357, 332, 292, 361, 333, 3542, 294, 284, 247, 331, 306, 322, 287, - 367, 341, 276, 258, 3980, 246, 245, 259, 309, 333, 250, 275, 334, 281, 253, 371, 3640, 213, 231, 301, 302, - 228, 289, 290, 281, 201, 284, 277, 4242, 205, 328, 237, 283, 295, 266, 230, 321, 348, 212, 308, 4103, 259, - 238, 245, 298, 330, 265, 271, 287, 267, 286, 290, 3856, 269, 242, 209, 314, 267, 278, 280, 314, 250, 433, - 238, 3654, 195, 246, 301, 298, 250, 270, 320, 269, 305, 258, 368, 3810, 231, 212, 279, 289, 252, 303, 287, - 295, 206, 264, 349, 4071, 242, 296, 271, 231, 307, 265, 254, 267, 317, 232, 348, 4077, 259, 222, 268, 235, - 324, 266, 256, 312, 246, 248, 325, 4000, 266, 201, 230, 293, 264, 265, 273, 301, 304, 253, 266, 3978, 228, - 232, 250, 248, 281, 219, 243, 293, 287, 253, 328, 3719]; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = false; - inputEosFlag = false; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: filepath ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case error readFile' + e); - } - } - function getContent(buf, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - lengthReal = readStreamSync.readSync( - buf, - {length: len} - ); - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent: ' + e); - } - } - - /* push inputbuffers into codec */ - 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 { - console.info(`in case queueInput err called,errMessage is ${error.message}`); - } - }) - } - - /* get outputbuffers from codec */ - 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); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - console.info('in case: setCallback out'); - } - eventEmitter.on('configure', (mediaDescription, srcPath, nextStep, done) => { - console.info('in case : configure in'); - videoDecodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info('in case : configure success'); - readFile(srcPath); - setCallback(nextStep); - eventEmitter.emit('setOutputSurface', done); - }); - }); - eventEmitter.on('setOutputSurface', (done) => { - videoDecodeProcessor.setOutputSurface(surfaceID, true, (err) => { - expect(err).assertUndefined(); - console.info('in case : setOutputSurface success, surfaceID ' + surfaceID); - eventEmitter.emit('prepare', done); - }) - }); - eventEmitter.on('prepare', (done) => { - videoDecodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info('in case : prepare success'); - eventEmitter.emit('start', done); - }); - }); - eventEmitter.on('start', (done) => { - videoDecodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info('in case : start success'); - }); - }); - eventEmitter.on('stop', (done) => { - videoDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info('in case : stop success'); - eventEmitter.emit('reset', done); - }); - }); - eventEmitter.on('reset', (done) => { - videoDecodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info('in case : reset success'); - eventEmitter.emit('release', done); - }); - }); - eventEmitter.on('release', (done) => { - videoDecodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info('in case : release success'); - videoDecodeProcessor = null; - done(); - }); - }); - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_H264_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_H264_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByName('avdec_h264', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByName success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG2_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG2_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG2_FRAME_SIZE; - let srcPath = BASIC_PATH + 'MPEG2_720_480.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mpeg2', - 'width': 720, - 'height': 480, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByName('avdec_mpeg2video', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByName success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG4_CALLBACK_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG4_CALLBACK_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG4_FRAME_SIZE; - let srcPath = BASIC_PATH + 'mpeg4_320_240.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mp4v-es', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - media.createVideoDecoderByName('avdec_mpeg4', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByName success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0600 - * @tc.name : test reconfigure for new file with the same format - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0600', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - eventEmitter.on('stop_for_callback_01_0600', (done) => { - videoDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info('in case : stop_for_callback_01_0600 success'); - eventEmitter.emit('reset_for_callback_01_0600', done); - }); - }); - eventEmitter.on('reset_for_callback_01_0600', (done) => { - videoDecodeProcessor.reset(async (err) => { - expect(err).assertUndefined(); - console.info('in case : reset_for_callback_01_0600 success'); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - readStreamSync = null; - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - surfaceID = globalThis.value; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, done); - }); - }); - media.createVideoDecoderByName('avdec_h264', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByName success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop_for_callback_01_0600', done); - }, done); - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0700 - * @tc.name : test reconfigure for new file with the different format - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0700', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - eventEmitter.on('stop_for_callback_01_0700', (done) => { - videoDecodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info('in case : stop_for_callback_01_0700 success'); - eventEmitter.emit('reset_for_callback_01_0700', done); - }); - }); - eventEmitter.on('reset_for_callback_01_0700', (done) => { - videoDecodeProcessor.reset(async (err) => { - expect(err).assertUndefined(); - console.info('in case : reset_for_callback_01_0700 success'); - srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - readStreamSync = null; - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - surfaceID = globalThis.value; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop', done); - }, done); - }); - }); - media.createVideoDecoderByName('avdec_h264', (err, processor) => { - expect(err).assertUndefined(); - console.info('in case : createVideoDecoderByName success'); - videoDecodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription, srcPath, - function() { - eventEmitter.emit('stop_for_callback_01_0700', done); - }, done); - }); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js deleted file mode 100644 index 91649e34d605c70abd8ce0e86d79531b6190e092..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareFuncPromiseTest.test.js +++ /dev/null @@ -1,537 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - - -describe('VideoDecoderFuncPromiseTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let inputQueue = []; - let outputQueue = []; - let isCodecData = false; - let inputEosFlag = false; - let surfaceID = ''; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - let ES_FRAME_SIZE = []; - const H264_FRAME_SIZE_240 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124, - 2049, 180, 122, 128, 1334, 143, 128, 1379, 116, 1884, 149, 122, 150, 1962, 176, 122, 122, 1197, 139, - 1853, 184, 151, 148, 1692, 209, 129, 126, 1736, 149, 135, 104, 1775, 165, 160, 121, 1653, 163, 123, - 112, 1907, 181, 129, 107, 1808, 177, 125, 111, 2405, 166, 144, 114, 1833, 198, 136, 113, 1960, 206, - 139, 116, 1791, 175, 130, 129, 1909, 194, 138, 119, 1807, 160, 156, 124, 1998, 184, 173, 114, 2069, 181, - 127, 139, 2212, 182, 138, 146, 1993, 214, 135, 139, 2286, 194, 137, 120, 2090, 196, 159, 132, 2294, 194, - 148, 137, 2312, 183, 163, 106, 2118, 201, 158, 127, 2291, 187, 144, 116, 2413, 139, 115, 2148, 178, 122, - 103, 2370, 207, 161, 117, 2291, 213, 159, 129, 2244, 243, 157, 133, 2418, 255, 171, 127, 2316, 185, 160, - 132, 2405, 220, 165, 155, 2539, 219, 172, 128, 2433, 199, 154, 119, 1681, 140, 1960, 143, 2682, 202, 153, - 127, 2794, 239, 158, 155, 2643, 229, 172, 125, 2526, 201, 181, 159, 2554, 233, 167, 125, 2809, 205, 164, - 117, 2707, 221, 156, 138, 2922, 240, 160, 146, 2952, 267, 177, 149, 3339, 271, 175, 136, 3006, 242, 168, - 141, 3068, 232, 194, 149, 2760, 214, 208, 143, 2811, 218, 184, 149, 137, 15486, 2116, 235, 167, 157, 2894, - 305, 184, 139, 3090, 345, 179, 155, 3226, 347, 160, 164, 3275, 321, 184, 174, 3240, 269, 166, 170, 3773, - 265, 169, 155, 3023, 301, 188, 161, 3343, 275, 174, 155, 3526, 309, 177, 173, 3546, 307, 183, 149, 3648, - 295, 213, 170, 3568, 305, 198, 166, 3641, 297, 172, 148, 3608, 301, 200, 159, 3693, 322, 209, 166, 3453, - 318, 206, 162, 3696, 341, 200, 176, 3386, 320, 192, 176, 3903, 373, 207, 187, 3305, 361, 200, 202, 3110, - 367, 220, 197, 2357, 332, 196, 201, 1827, 377, 187, 199, 860, 472, 173, 223, 238]; - const H263_FRAME_SIZE = - [ 96618, 3515, 4132, 4336, 4646, 3497, 4430, 5437, 7560, 4613, 4876, 4734, 53617, 4079, 4507, 5222, 6244, - 5843, 6601, 6622, 6751, 6539, 7666, 7706, 53977, 7311, 12906, 10308, 26791, 15983, 34794, 22110, 37165, - 24267, 36171, 18330, 53228, 7893, 13088, 9502, 8485, 9207, 8681, 9202, 8537, 7603, 9726, 8191, 51872, - 5535, 6146, 6341, 6933, 9365, 7828, 6547, 7638, 7009, 7025, 8873, 51045, 5056, 4858, 4887, 9614, 5953, - 5972, 6116, 6060, 6296, 6239, 6400, 50928, 4937, 5054, 5371, 6728, 6286, 6524, 6646, 6549, 6036, 6214, - 5866, 51109, 4778, 5273, 6327]; - const MPEG2_FRAME_SIZE = - [ 38462, 55096, 8660, 3417, 1197, 2209, 984, 718, 783, 623, 659, 694, 14174, 580, 421, 495, 480, 476, 534, - 660, 699, 601, 603, 720, 12585, 555, 532, 776, 789, 762, 766, 732, 671, 735, 777, 948, 12650, 827, 766, - 835, 747, 847, 940, 1121, 1092, 1001, 980, 989, 12746, 945, 912, 1046, 1118, 1134, 1050, 1073, 1051, 1195, - 1085, 1182, 12874, 992, 1007, 985, 1040, 1143, 1157, 1150, 1247, 1149, 1246, 1145, 12870, 1041, 1066, 1314, - 1239, 1283, 1223, 1224, 1270, 1427, 1406, 1516, 12949, 1228, 1299, 1439, 1358, 1455, 1311, 1396, 1416, 1470, - 1393, 1502, 12999, 1232, 1400, 1348, 1335, 1461, 1404, 1412, 1426, 1548, 1481, 1488, 12840, 1229, 1342, 1323, - 1353, 1524, 1363, 1475, 1540, 1495, 1489, 1438, 12762, 1291, 1303, 1470, 1494, 1488, 1474, 1453, 1607, 1485, - 1589, 1762, 12548, 1363, 1317, 1435, 1411, 1338, 1373, 1605, 1639, 1429, 1392, 1543, 12332, 1255, 1200, 1291, - 1337, 1341, 1356, 1214, 1456, 1353, 1314, 1502, 12151, 1192, 1290, 1203, 1284, 1154, 1264, 1358, 1390, 1433, - 1194, 1325, 11904, 993, 1007, 1149, 1099, 1182, 1076, 1074, 1092, 1030, 1272, 1178, 11710, 966, 879, 860, 955, - 898, 967, 927, 1066, 997, 1083, 940, 11717, 648, 705, 901, 925, 930, 868, 798, 846, 781, 825, 1027, 11587, 785, - 733, 731, 848, 753, 806, 699, 837, 750, 762, 748, 11541, 678, 742, 667, 735, 702, 837, 695, 773, 849, 869, 769, - 11381, 664, 705, 714, 698, 814, 846, 757, 802, 857, 905, 772, 11265, 718, 643, 597, 687, 774, 843, 747, 785, - 683, 1135, 676, 11259, 616, 595, 773, 746, 798, 722, 798, 790, 959, 771, 907, 11234, 705, 675, 773, 764, 846, - 789, 840, 853, 828, 774, 842, 11263, 758, 758, 757, 820, 847, 834, 884, 842, 988, 750, 952, 11236, 776, 640, 727, - 832, 855, 733, 822, 827, 862, 697, 924, 11176, 675, 615, 688, 818, 783, 746, 901, 834, 892, 759, 923, 11181, 661, - 578, 720, 697]; - const MPEG4_FRAME_SIZE = - [ 11895, 8109, 1578, 1616, 1313, 572, 805, 837, 755, 706, 952, 879, 13193, 422, 389, 509, 725, 465, 479, 959, - 677, 364, 541, 696, 9306, 322, 318, 767, 590, 422, 530, 403, 505, 566, 445, 508, 7783, 460, 405, 343, 451, - 608, 431, 411, 543, 487, 527, 400, 6287, 385, 418, 391, 592, 434, 412, 398, 504, 492, 479, 561, 5413, 317, - 355, 422, 467, 452, 476, 460, 490, 492, 485, 451, 5036, 312, 408, 460, 432, 502, 388, 475, 407, 544, 401, - 487, 4404, 362, 378, 427, 416, 426, 456, 414, 438, 424, 442, 444, 4310, 362, 388, 393, 390, 441, 398, 423, - 369, 443, 406, 392, 4231, 343, 363, 355, 390, 459, 371, 378, 381, 405, 392, 426, 3975, 387, 337, 393, 439, - 378, 355, 374, 484, 381, 373, 423, 3869, 312, 350, 400, 345, 356, 320, 473, 431, 386, 338, 431, 3426, 268, - 315, 416, 383, 373, 381, 354, 383, 328, 348, 418, 3715, 324, 361, 331, 350, 302, 409, 377, 359, 384, 334, - 326, 3439, 266, 324, 329, 353, 405, 303, 357, 332, 292, 361, 333, 3542, 294, 284, 247, 331, 306, 322, 287, - 367, 341, 276, 258, 3980, 246, 245, 259, 309, 333, 250, 275, 334, 281, 253, 371, 3640, 213, 231, 301, 302, - 228, 289, 290, 281, 201, 284, 277, 4242, 205, 328, 237, 283, 295, 266, 230, 321, 348, 212, 308, 4103, 259, - 238, 245, 298, 330, 265, 271, 287, 267, 286, 290, 3856, 269, 242, 209, 314, 267, 278, 280, 314, 250, 433, - 238, 3654, 195, 246, 301, 298, 250, 270, 320, 269, 305, 258, 368, 3810, 231, 212, 279, 289, 252, 303, 287, - 295, 206, 264, 349, 4071, 242, 296, 271, 231, 307, 265, 254, 267, 317, 232, 348, 4077, 259, 222, 268, 235, - 324, 266, 256, 312, 246, 248, 325, 4000, 266, 201, 230, 293, 264, 265, 273, 301, 304, 253, 266, 3978, 228, - 232, 250, 248, 281, 219, 243, 293, 287, 253, 328, 3719]; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = false; - inputEosFlag = false; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${error.message}`); - expect(err).assertUndefined(); - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: filepath ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.error('in case readFile' + e); - } - } - - function getContent(buf, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - lengthReal = readStreamSync.readSync( - buf, - {length: len} - ); - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent ' + e); - } - } - - /* push inputbuffers into codec */ - 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, 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); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - console.info('in case: setCallback out'); - } - - async function toCreateVideoDecoderByMime(mime, done) { - await media.createVideoDecoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoDecodeProcessor = processor; - console.info('in case : createVideoDecoderByMime success'); - } else { - console.info('in case : createVideoDecoderByMime fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - async function toCreateVideoDecoderByName(name, done) { - await media.createVideoDecoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoDecodeProcessor = processor; - console.info('in case : createVideoDecoderByName success'); - } else { - console.info('in case : createVideoDecoderByName fail'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - async function toConfigure(mediaDescription, srcPath) { - await videoDecodeProcessor.configure(mediaDescription).then(() =>{ - console.info('in case : configure success'); - readFile(srcPath); - }, failCallback).catch(failCatch); - } - async function toSetOutputSurface(isDisplay) { - await videoDecodeProcessor.setOutputSurface(surfaceID, isDisplay).then(() => { - console.info('in case : setOutputSurface success. surfaceID ' + surfaceID); - }, failCallback).catch(failCatch); - } - eventEmitter.on('nextStep', async (done) => { - console.info('in case : nextStep success'); - await videoDecodeProcessor.stop().then(() => { - console.info('in case : stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('in case : reset success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.release().then(() => { - console.info('in case : release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - console.info('in case : done'); - done(); - }); - async function toPrepare() { - await videoDecodeProcessor.prepare().then(() => { - console.info('in case : prepare success'); - }, failCallback).catch(failCatch); - } - async function toStart() { - await videoDecodeProcessor.start().then(() => { - console.info('in case : start success'); - }, failCallback).catch(failCatch); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_H264_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_H264_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByName('avdec_h264', done); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG2_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG2_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG2_FRAME_SIZE; - let srcPath = BASIC_PATH + 'MPEG2_720_480.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mpeg2', - 'width': 720, - 'height': 480, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByName('avdec_mpeg2video', done); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG4_PROMISE_0100 - * @tc.name : 001.basic Video decode function - * @tc.desc : start-> EOS -> stop -> reset - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_MPEG4_PROMISE_0100', 0, async function (done) { - ES_FRAME_SIZE = MPEG4_FRAME_SIZE; - let srcPath = BASIC_PATH + 'mpeg4_320_240.es'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/mp4v-es', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByName('avdec_mpeg4', done); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0600 - * @tc.name : test reconfigure for new file with the same format - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0600', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByName('avdec_h264', done); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - eventEmitter.once('reConfigure_for_promise_01_0600', async (done) => { - console.info('in case : reConfigure_for_promise_01_0600 success'); - await videoDecodeProcessor.stop().then(() => { - console.info('in case : stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('in case : reset success'); - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - readStreamSync = null; - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - surfaceID = globalThis.value; - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }); - setCallback( - function(){eventEmitter.emit('reConfigure_for_promise_01_0600', done);} - ); - await toPrepare(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0700 - * @tc.name : test reconfigure for new file with the different format - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0700', 0, async function (done) { - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - isCodecData = true; - let srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - await toCreateVideoDecoderByName('avdec_h264', done); - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - srcPath = BASIC_PATH + 'out_320_240_10s.h264'; - mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60.00, - 'max_input_size': 150000, - } - eventEmitter.on('reConfigure_for_promise_01_0700', async (done) => { - console.info('in case : reConfigure_for_promise_01_0700 success'); - await videoDecodeProcessor.stop().then(() => { - console.info('in case : stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('in case : reset success'); - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - readStreamSync = null; - ES_FRAME_SIZE = H264_FRAME_SIZE_240; - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - surfaceID = globalThis.value; - await toConfigure(mediaDescription, srcPath); - await toSetOutputSurface(true); - setCallback( - function(){eventEmitter.emit('nextStep', done);} - ); - await toPrepare(); - await toStart(); - }); - setCallback( - function(){eventEmitter.emit('reConfigure_for_promise_01_0700', done);} - ); - await toPrepare(); - await toStart(); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js deleted file mode 100644 index a17198490915bc5267e6b01f5ace750adf9465bb..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliCallbackTest.test.js +++ /dev/null @@ -1,1278 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -export -const DECODE_STEP = { - WAIT_FOR_EOS : 'waitForEOS', - CONFIGURE : 'configure', - SETSURFACE : 'setSurface', - PREPARE : 'prepare', - START : 'start', - FLUSH : 'flush', - STOP : 'stop', - RESET : 'reset', - WAIT_FOR_ALL_OUTS : 'waitForAllOuts', - ERROR : 'error', - RELEASE : 'release', -} - -describe('VideoDecoderSoftwareReliCallbackTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let position = 0; - let eosFrameId = -1; - let inputQueue = []; - let outputQueue = []; - let isCodecData = true; - let inputEosFlag = false; - let workdoneAtEOS = false; - let surfaceID = ''; - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - const SRCPATH = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60, - 'max_input_size': 150000, - } - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - let ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - workdoneAtEOS = false; - eosFrameId = -1; - inputEosFlag = false; - position = 0; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let failCallback = function(err) { - console.info(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - console.info(`in case error failCatch called,errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - function printError(err, expectFail) { - expect((err != undefined) == expectFail).assertTrue(); - if (expectFail == false && err != undefined) { - console.info('in case error failCatch called,err is ' + err); - console.info(`in case error failCatch called,errMessage is ${err.message}`); - } - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: file path ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case readFile' + e); - } - } - - function getContent(buf, pos, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - if (pos == -1) { - lengthReal = readStreamSync.readSync(buf, { - length: len, - }); - } else { - lengthReal = readStreamSync.readSync(buf, { - length: len, - position: pos, - }); - } - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent err ' + err); - } - } - - /* push inputbuffers into codec */ - 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, outputObject) { - if (outputObject.flags == 1 ) { - if (workdoneAtEOS) { - doneWork(nextStep); - } - return; - } - frameCountOut++; - videoDecodeProcessor.freeOutputBuffer(outputObject, () => { - console.log('in case: release output count:' + frameCountOut); - }) - } - - function toConfigure(mySteps, done, expectFail) { - videoDecodeProcessor.configure(mediaDescription, (err) => { - console.info(`case configure callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }) - } - function toPrepare(mySteps, done, expectFail) { - videoDecodeProcessor.prepare((err) => { - console.info(`case prepare callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toStart(mySteps, done, expectFail) { - let timeDelay = 0; - videoDecodeProcessor.start((err) => { - console.info(`case start callback`); - printError(err, expectFail); - if (mySteps[0] == DECODE_STEP.FLUSH) { - timeDelay = 500; - } - setTimeout(() => { - toNextStep(mySteps, done); - }, timeDelay); - }); - } - function toFlush(mySteps, done, expectFail) { - videoDecodeProcessor.flush((err) => { - console.info(`case flush callback`); - printError(err, expectFail); - if (expectFail == false) { - inputEosFlag = false; - position = ES_FRAME_SIZE[0]; - inputQueue = []; - timestamp = 0; - frameCountIn = 1; - } - toNextStep(mySteps, done); - }); - } - function toStop(mySteps, done, expectFail) { - videoDecodeProcessor.stop((err) => { - console.info(`case stop callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toReset(mySteps, done, expectFail) { - videoDecodeProcessor.reset((err) => { - console.info(`case reset callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toSetOutputSurface(mySteps, done, expectFail) { - videoDecodeProcessor.setOutputSurface(surfaceID, true, (err) => { - console.info('case setOutputSurface callback, surfaceID ' + surfaceID); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - - function toNextStep(mySteps, done) { - console.info('case myStep[0]: ' + mySteps[0]); - if (mySteps[0] == DECODE_STEP.RELEASE) { - if (videoDecodeProcessor != null){ - videoDecodeProcessor.release((err) => { - printError(err, false); - console.info('in case : videoDecodeProcessor release callback'); - videoDecodeProcessor = null; - console.info('case to done'); - done(); - }); - } - return; - } - switch (mySteps[0]) { - case DECODE_STEP.CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toConfigure(mySteps, done, true); - } else { - toConfigure(mySteps, done, false); - } - break; - case DECODE_STEP.SETSURFACE: - mySteps.shift(); - console.info(`case to setOutputSurface`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toSetOutputSurface(mySteps, done, true); - } else { - toSetOutputSurface(mySteps, done, false); - } - break; - case DECODE_STEP.PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toPrepare(mySteps, done, true); - } else { - toPrepare(mySteps, done, false); - } - break; - case DECODE_STEP.START: - mySteps.shift(); - console.info(`case to start`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStart(mySteps, done, true); - } else { - readStreamSync = undefined; - readFile(SRCPATH); - frameCountIn = 0; - frameCountOut = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - position = 0; - toStart(mySteps, done, false); - } - break; - case DECODE_STEP.FLUSH: - mySteps.shift(); - console.info(`case to flush`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toFlush(mySteps, done, true); - } else { - toFlush(mySteps, done, false); - } - break; - case DECODE_STEP.STOP: - mySteps.shift(); - console.info(`case to stop`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStop(mySteps, done, true); - } else { - toStop(mySteps, done, false); - } - break; - case DECODE_STEP.RESET: - mySteps.shift(); - console.info(`case to reset`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toReset(mySteps, done, true); - } else { - toReset(mySteps, done, false); - } - break; - case DECODE_STEP.WAIT_FOR_EOS: - mySteps.shift(); - setTimeout(() =>{ - expect(inputEosFlag).assertTrue(); - if (inputEosFlag == false) { - console.info(`in case error wait for eos: inputEosFlag = false`); - } - toNextStep(mySteps, done); - }, 7000); // wait 7000 ms for eos - break; - case DECODE_STEP.WAIT_FOR_ALL_OUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - default: - break; - } - } - - function setCallback(nextStep){ - videoDecodeProcessor.on('needInputData', async (inBuffer) => { - console.info('in case: inputBufferAvailable inBuffer.index: '+ inBuffer.index); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged',(format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - } - - function toCreateVideoDecoderByMime(mime, mySteps, done) { - media.createVideoDecoderByMime(mime, (err, processor) => { - console.info(`case createVideoDecoderByMime callback`); - printError(err, false); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }) - } - function toCreateVideoDecoderByName(name, mySteps, done) { - media.createVideoDecoderByName(name, (err, processor) => { - printError(err, false); - console.info(`case createVideoDecoderByName callback`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }) - } - async function doneWork(nextStep) { - videoDecodeProcessor.stop((err) => { - printError(err, false); - console.info('case stop callback'); - videoDecodeProcessor.reset((err) => { - printError(err, false); - console.info('case reset callback'); - videoDecodeProcessor.release((err) => { - printError(err, false); - console.info('case release callback'); - videoDecodeProcessor = null; - nextStep(); - }) - }) - }) - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0100 - * @tc.name : test set EOS manually before last frame and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0200 - * @tc.name : test flush at running state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0300 - * @tc.name : test flush at EOS state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - eosFrameId = 50; - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0400 - * @tc.name : test stop at running state and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0500 - * @tc.name : test stop and restart - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0100 - * @tc.name : 001.create -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0300 - * @tc.name : 003.start -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_CALLBACK_0900', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS , - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0100 - * @tc.name : 001.create -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0200 - * @tc.name : 002.configure -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0400 - * @tc.name : 004.start -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0500 - * @tc.name : 005.flush -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0600 - * @tc.name : 006.stop -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.START, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0800 - * @tc.name : 008.reset -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0100 - * @tc.name : 001.create -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.FLUSH, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0400 - * @tc.name : 004.start -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP , DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0100 - * @tc.name : 001.create -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.STOP, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0400 - * @tc.name : 004.start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0100 - * @tc.name : 001.create -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.RESET, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0400 - * @tc.name : 004.start -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_CALLBACK_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_CALLBACK_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) -}) diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js b/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js deleted file mode 100644 index bddb11fc0d291beb838e809e2acd3e5b8cb514dd..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/js/test/VideoDecoderSoftwareReliPromiseTest.test.js +++ /dev/null @@ -1,1271 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import Fileio from '@ohos.fileio' -import router from '@system.router' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -export -const DECODE_STEP = { - WAIT_FOR_EOS : 'waitForEOS', - CONFIGURE : 'configure', - SETSURFACE : 'setSurface', - PREPARE : 'prepare', - START : 'start', - FLUSH : 'flush', - STOP : 'stop', - RESET : 'reset', - WAIT_FOR_ALL_OUTS : 'waitForAllOuts', - ERROR : 'error', - RELEASE : 'release', -} - -describe('VideoDecoderSoftwareReliPromiseTest', function () { - let videoDecodeProcessor = null; - let readStreamSync = undefined; - let frameCountIn = 0; - let frameCountOut = 0; - let timestamp = 0; - let position = 0; - let eosFrameId = -1; - let inputQueue = []; - let outputQueue = []; - let isCodecData = true; - let inputEosFlag = false; - let workdoneAtEOS = false; - let surfaceID = ''; - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videodecoder/'; - const SRCPATH = BASIC_PATH + 'out_320_240_10s.h264'; - let mediaDescription = { - 'track_type': 1, - 'codec_mime': 'video/avc', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 60, - 'max_input_size': 150000, - } - const H264_FRAME_SIZE_60FPS_320 = - [ 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, - 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, - 128, 1697, 168, 149, 117, 1938, 170, 141, 142, 1830, 106, 161, 122, 1623, 160, 154, 156, 1998, 230, - 177, 139, 1650, 186, 128, 134, 1214, 122, 1411, 120, 1184, 128, 1591, 195, 145, 105, 1587, 169, 140, - 118, 1952, 177, 150, 161, 1437, 159, 123, 1758, 180, 165, 144, 1936, 214, 191, 175, 2122, 180, 179, - 160, 1927, 161, 184, 119, 1973, 218, 210, 129, 1962, 196, 127, 154, 2308, 173, 127, 1572, 142, 122, - 2065, 262, 159, 206, 2251, 269, 179, 170, 2056, 308, 168, 191, 2090, 303, 191, 110, 1932, 272, 162, - 122, 1877, 245, 167, 141, 1908, 294, 162, 118, 1493, 132, 1782, 273, 184, 133, 1958, 274, 180, 149, - 2070, 216, 169, 143, 1882, 224, 149, 139, 1749, 277, 184, 139, 2141, 197, 170, 140, 2002, 269, 162, - 140, 1862, 202, 179, 131, 1868, 214, 164, 140, 1546, 226, 150, 130, 1707, 162, 146, 1824, 181, 147, - 130, 1898, 209, 143, 131, 1805, 180, 148, 106, 1776, 147, 141, 1572, 177, 130, 105, 1776, 178, 144, - 122, 1557, 142, 124, 114, 1436, 143, 126, 1326, 127, 1755, 169, 127, 105, 1807, 177, 131, 134, 1613, - 187, 137, 136, 1314, 134, 118, 2005, 194, 129, 147, 1566, 185, 132, 131, 1236, 174, 137, 106, 11049, - 574, 126, 1242, 188, 130, 119, 1450, 187, 137, 141, 1116, 124, 1848, 138, 122, 1605, 186, 127, 140, - 1798, 170, 124, 121, 1666, 157, 128, 130, 1678, 135, 118, 1804, 169, 135, 125, 1837, 168, 124, 124]; - let ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await toDisplayPage().then(() => { - }, failCallback).catch(failCatch); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - frameCountIn = 0; - frameCountOut = 0; - timestamp = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - workdoneAtEOS = false; - eosFrameId = -1; - inputEosFlag = false; - position = 0; - surfaceID = globalThis.value; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoDecodeProcessor != null) { - await videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - await router.clear().then(() => { - }, failCallback).catch(failCatch); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let caseCallback = function(err) { - console.info(`in case caseCallback called, caseMessage is ${err.message}`); - } - let failCallback = function(err) { - console.error(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - console.error(`in case error failCatch called,errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let callbackExpectOK = function(err, mySteps, done) { - console.error(`in case error callbackExpectOK called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - toNextStep(mySteps, done); - } - let callbackExpectFail = function(err, mySteps, done) { - console.info(`in case callbackExpectFail called, errMessage is ${err.message}`); - expect(err != undefined).assertTrue(); - toNextStep(mySteps, done); - } - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - async function toDisplayPage() { - let path = 'pages/display/display'; - let options = { - uri: path, - } - try { - await router.push(options); - } catch (e) { - console.error('in case toDisplayPage' + e); - } - } - function readFile(path){ - console.info('in case : read file start execution'); - try { - console.info('in case: file path ' + path); - readStreamSync = Fileio.createStreamSync(path, 'rb'); - } catch(e) { - console.info('in case readFile' + e); - } - } - - function getContent(buf, pos, len) { - console.info('start get content, len ' + len + ' buf.byteLength ' + buf.byteLength); - let lengthReal = -1; - try { - if (pos == -1) { - lengthReal = readStreamSync.readSync(buf, { - length: len, - }); - } else { - lengthReal = readStreamSync.readSync(buf, { - length: len, - position: pos, - }); - } - console.info('in case: lengthReal: ' + lengthReal); - } catch(e) { - console.error('in case error getContent err ' + err); - } - } - - /* push inputbuffers into codec */ - 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, outputObject) { - if (outputObject.flags == 1 ) { - if (workdoneAtEOS) { - await doneWork(); - nextStep(); - } - 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) { - videoDecodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toPrepare(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.prepare().then(() => { - console.info(`case prepare success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toStart(mySteps, done, failureCallback, catchCallback) { - let timeDelay = 0; - videoDecodeProcessor.start().then(() => { - console.info(`case start success`); - if (mySteps[0] == DECODE_STEP.FLUSH) { - timeDelay = 500; - } - setTimeout(() => { - toNextStep(mySteps, done); - }, timeDelay); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toFlush(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.flush().then(() => { - console.info(`case flush success`); - position = ES_FRAME_SIZE[0]; - inputQueue = []; - timestamp = 0; - inputEosFlag = false; - frameCountIn = 1; - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toStop(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.stop().then(() => { - console.info(`case stop success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toReset(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.reset().then(() => { - console.info(`case reset success`); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - function toSetOutputSurface(mySteps, done, failureCallback, catchCallback) { - videoDecodeProcessor.setOutputSurface(surfaceID, true).then(() => { - console.info('in case : setOutputSurface success, surfaceID ' + surfaceID); - toNextStep(mySteps, done); - }, (err) => {failureCallback(err, mySteps, done)}).catch(catchCallback); - } - - function toNextStep(mySteps, done) { - console.info('case myStep[0]: ' + mySteps[0]); - if (mySteps[0] == DECODE_STEP.RELEASE) { - if (videoDecodeProcessor != null) { - videoDecodeProcessor.release().then(() => { - console.info('in case : videoDecodeProcessor release success'); - videoDecodeProcessor = null; - console.info('case to done'); - done(); - }, failCallback).catch(failCatch); - } - return; - } - switch (mySteps[0]) { - case DECODE_STEP.CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toConfigure(mySteps, done, callbackExpectFail, failCatch); - } else { - toConfigure(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.SETSURFACE: - mySteps.shift(); - console.info(`case to setOutputSurface`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toSetOutputSurface(mySteps, done, callbackExpectFail, failCatch); - } else { - toSetOutputSurface(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toPrepare(mySteps, done, callbackExpectFail, failCatch); - } else { - toPrepare(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.START: - mySteps.shift(); - console.info(`case to start`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStart(mySteps, done, callbackExpectFail, failCatch); - } else { - readStreamSync = undefined; - readFile(SRCPATH); - frameCountIn = 0; - frameCountOut = 0; - inputQueue = []; - outputQueue = []; - isCodecData = true; - inputEosFlag = false; - position = 0; - toStart(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.FLUSH: - mySteps.shift(); - console.info(`case to flush`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toFlush(mySteps, done, callbackExpectFail, failCatch); - } else { - toFlush(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.STOP: - mySteps.shift(); - console.info(`case to stop`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toStop(mySteps, done, callbackExpectFail, failCatch); - } else { - toStop(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.RESET: - mySteps.shift(); - console.info(`case to reset`); - if (mySteps[0] == DECODE_STEP.ERROR) { - mySteps.shift(); - toReset(mySteps, done, callbackExpectFail, failCatch); - } else { - toReset(mySteps, done, callbackExpectOK, failCatch); - } - break; - case DECODE_STEP.WAIT_FOR_EOS: - mySteps.shift(); - setTimeout(() =>{ - expect(inputEosFlag).assertTrue(); - if (inputEosFlag == false) { - console.info(`in case error inputEosFlag == false`); - } - toNextStep(mySteps, done); - }, 7000); // wait 7000 ms for eos - break; - case DECODE_STEP.WAIT_FOR_ALL_OUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - default: - break; - } - } - - function setCallback(nextStep){ - videoDecodeProcessor.on('needInputData', async (inBuffer) => { - console.info('in case: inputBufferAvailable inBuffer.index: '+ inBuffer.index); - enqueueInputs(inBuffer); - }); - - videoDecodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - dequeueOutputs(nextStep, outBuffer); - }); - - videoDecodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoDecodeProcessor.on('streamChanged', (format) => { - console.info('in case: Output format changed: ' + format.toString()); - }); - } - - function toCreateVideoDecoderByMime(mime, mySteps, done) { - media.createVideoDecoderByMime(mime).then((processor) => { - console.info(`case createVideoDecoderByMime success`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - function toCreateVideoDecoderByName(name, mySteps, done) { - media.createVideoDecoderByName(name).then((processor) => { - console.info(`case createVideoDecoderByName success`); - videoDecodeProcessor = processor; - setCallback(done); - toNextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - async function doneWork() { - await videoDecodeProcessor.stop().then(() => { - console.info('case stop success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.reset().then(() => { - console.info('case reset success'); - }, failCallback).catch(failCatch); - await videoDecodeProcessor.release().then(() => { - console.info('case release success'); - }, failCallback).catch(failCatch); - videoDecodeProcessor = null; - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0100 - * @tc.name : test set EOS manually before last frame and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0200 - * @tc.name : test flush at running state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.WAIT_FOR_ALL_OUTS); - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0300 - * @tc.name : test flush at EOS state - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_ALL_OUTS); - eosFrameId = 50; - workdoneAtEOS = true; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0400 - * @tc.name : test stop at running state and reset - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0500 - * @tc.name : test stop and restart - * @tc.desc : test basic function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_FUNCTION_PROMISE_01_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0100 - * @tc.name : 001.create -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0300 - * @tc.name : 003.start -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.CONFIGURE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_CONFIGURE_PROMISE_0900', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS , - DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_PREPARE_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.PREPARE, DECODE_STEP.ERROR, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0100 - * @tc.name : 001.create -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0200 - * @tc.name : 002.configure -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0400 - * @tc.name : 004.start -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0500 - * @tc.name : 005.flush -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0600 - * @tc.name : 006.stop -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.START, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0800 - * @tc.name : 008.reset -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_START_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.START, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0100 - * @tc.name : 001.create -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.FLUSH, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0400 - * @tc.name : 004.start -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP , DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_FLUSH_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.FLUSH, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0100 - * @tc.name : 001.create -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.STOP, - DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0400 - * @tc.name : 004.start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_STOP_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.STOP, DECODE_STEP.ERROR, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0100 - * @tc.name : 001.create -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.RESET, - DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0400 - * @tc.name : 004.start -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.FLUSH, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0600', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.STOP, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0700', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_RESET_PROMISE_0800', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.RESET, DECODE_STEP.RESET, DECODE_STEP.RELEASE); - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0100', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0200', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0300', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.RESET, DECODE_STEP.CONFIGURE, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0400', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_DECODER_API_EOS_PROMISE_0500', 0, async function (done) { - let mySteps = new Array(DECODE_STEP.CONFIGURE, DECODE_STEP.SETSURFACE, DECODE_STEP.PREPARE, DECODE_STEP.START, - DECODE_STEP.WAIT_FOR_EOS, DECODE_STEP.STOP, DECODE_STEP.START, DECODE_STEP.STOP, DECODE_STEP.RELEASE); - eosFrameId = 50; - toCreateVideoDecoderByName('avdec_h264', mySteps, done); - }) -}) diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/icon.png b/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/info.txt b/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/info.txt deleted file mode 100644 index 9632a32a7e0b92c0b921db34929e0f03c26a84df..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/info.txt +++ /dev/null @@ -1 +0,0 @@ -streamId:0 pts:0 pts_time:0.000000 size:197165 flag:1 \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/mp3_MP3.mp3 b/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/mp3_MP3.mp3 deleted file mode 100644 index 2ac11d0b213c4686d6138e4234054ca13a15c63d..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/videoDecoder/src/main/resources/base/media/mp3_MP3.mp3 and /dev/null differ diff --git a/multimedia/media/media_js_standard/videoEncoder/BUILD.gn b/multimedia/media/media_js_standard/videoEncoder/BUILD.gn deleted file mode 100644 index 73b133096551a9872c3dcfdb64277c9021418eb1..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("video_encoder_js_hap") { - hap_profile = "./src/main/config.json" - js2abc = true - deps = [ - ":video_encoder_js_assets", - ":video_encoder_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsVideoEncoderJsTest" -} -ohos_js_assets("video_encoder_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("video_encoder_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/media/media_js_standard/videoEncoder/Test.json b/multimedia/media/media_js_standard/videoEncoder/Test.json deleted file mode 100644 index 6a35730452782d44b6d9d058c73e896ea6cf0974..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/Test.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "Configuration for videoEncoder Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "2000000", - "package": "ohos.acts.multimedia.video.videoencoder", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsVideoEncoderJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - ] - }, - { - "type": "ShellKit", - "run-command": [ - "rm -R /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results", - "mkdir -p /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/", - "chmod 777 -R /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder", - "chmod 777 /data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/*" - ], - "teardown-command":[ - ] - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/videoEncoder/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/videoEncoder/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/config.json b/multimedia/media/media_js_standard/videoEncoder/src/main/config.json deleted file mode 100644 index b52e6a6816dd98d69a1b95ebd59800dc35a0bb5d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.video.videoencoder", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "iconId": 16777218, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "descriptionId": 16777217, - "visible": true, - "labelId": 16777216, - "icon": "$media:icon", - "name": "ohos.acts.multimedia.video.videoencoder.MainAbility", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "homeAbility": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "mainAbility": "ohos.acts.multimedia.video.videoencoder.MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "ohos.acts.multimedia.video.videoencoder", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/app.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/app.js deleted file mode 100644 index 830070d196d86b127cea947d168bfd116f446205..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/en-US.json b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/zh-CN.json b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.css b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.css deleted file mode 100644 index c9195944a956c0d5628c701b7a3d9d2ed525cd2d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.hml b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 8d0e2061b88c99c91488405f0f2ead0c77de1a9e..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.js deleted file mode 100644 index 67f8b8567ccc4932331b7a18a6b947340d84fb40..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - this.timeout = 60000 - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/List.test.js deleted file mode 100644 index 078ccff26c02b2a1123d23b8fef58a5b1f2def17..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/List.test.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -require('./VideoEncoderSoftwareFuncCallbackTest.test.js') -require('./VideoEncoderSoftwareFuncPromiseTest.test.js') -require('./VideoEncoderSoftwareReliabilityCallbackTest.test.js') -require('./VideoEncoderSoftwareReliabilityPromiseTest.test.js') -require('./VideoEncoderMultiInstancesTest.test.js') -require('./VideoEncoderEnumTest.test.js') -require('./VideoHardwareEncoderEnumTest.test.js') \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderEnumTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderEnumTest.test.js deleted file mode 100644 index 504a0e0df72cacc48c5a4c14177bf7b54ca5ee11..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderEnumTest.test.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('VideoEncoderEnum', function () { - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - - /* * - * @tc.number : SUB_MEDIA_VIDEO_ENCODER_ENUM_VideoEncodeBitrateMode_0100 - * @tc.name : 001.VideoEncodeBitrateMode - * @tc.desc : Test Enumerate VideoEncodeBitrateMode - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_DECODER_ENUM_VideoEncodeBitrateMode_0100', 0, async function (done) { - expect(media.VideoEncodeBitrateMode.CBR).assertEqual(0); - expect(media.VideoEncodeBitrateMode.VBR).assertEqual(1); - expect(media.VideoEncodeBitrateMode.CQ).assertEqual(2); - done(); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderMultiInstancesTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderMultiInstancesTest.test.js deleted file mode 100644 index 744177491995920222c7ab8d13439a0ad9e26a0d..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderMultiInstancesTest.test.js +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import mediademo from '@ohos.multimedia.mediademo' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('videoEncoderSoftwareMultiInstances', function () { - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const ROOT = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/'; - const BASIC_PATH = ROOT + 'video_multiinstances_'; - let videoEncodeProcessor; - let mediaTest; - let surfaceID = ''; - let outputQueue = []; - let outputCnt = 0; - let frameTotal = 100; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let sawOutputEOS = false; - let needGetMediaDes = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - videoEncodeProcessor = null; - mediaTest = null; - surfaceID = ''; - outputQueue = []; - outputCnt = 0; - frameTotal = 100; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function resetParam() { - outputQueue = []; - outputCnt = 0; - frameTotal = 100; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - } - - function writeFile(path, buf, len){ - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function dequeueOutputs(path, nextStep) { - while (outputQueue.length > 0) { - let outputObject = outputQueue.shift(); - outputCnt += 1; - if (outputObject.flags == 1) { - console.info("case last frame"); - mediaTest.closeStream(surfaceID); - toRelease(); - nextStep(); - return; - } else { - console.info('not last frame, write data to file'); - writeFile(path, outputObject.data, outputObject.length); - console.info("write to file success"); - videoEncodeProcessor.freeOutputBuffer(outputObject).then(() => { - console.info('release output success'); - }); - } - } - } - - function setCallback(path, nextStep) { - console.info('case callback'); - videoEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - console.info('outBuffer.flags: ' + outBuffer.flags); - if (needGetMediaDes) { - videoEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes = false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - dequeueOutputs(path, nextStep); - }); - - videoEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - videoEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - async function toCreateByMime(mime, done) { - await media.createVideoEncoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByMime success'); - } else { - console.info('in case : createVideoEncoderByMime fail'); - expect().assertFail(); - done(); - } - }) - } - - async function toCreateByName(name, done) { - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - } - - async function toGetVideoEncoderCaps() { - await videoEncodeProcessor.getVideoEncoderCaps().then((videoCaps) => { - console.info("case get getVideoEncoderCaps success"); - console.info("print videoCaps: " + videoCaps) - }, failCallback).catch(failCatch); - } - - function toCreateStream() { - mediaTest = mediademo.createMediaTest(); - } - - function toSetStreamParam(width, height, framerate, frameTotal) { - console.info('case set stream parameter'); - mediaTest.setResolution(width, height); - mediaTest.setFrameRate(framerate); - mediaTest.setFrameCount(frameTotal); - } - - async function toGetInputSurface() { - await videoEncodeProcessor.getInputSurface().then((inputSurface) => { - expect(inputSurface != undefined).assertTrue(); - console.info('case getInputSurface success'); - surfaceID = inputSurface; - }, failCallback).catch(failCatch); - } - - function toStartStream() { - console.info('case start stream'); - mediaTest.startStream(surfaceID); - } - - function toStopStream() { - console.info('case stop stream'); - mediaTest.closeStream(surfaceID); - } - - async function toConfigure(mediaDescription) { - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - } - - async function toPrepare() { - await videoEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - } - - async function toStart() { - await videoEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - } - - async function toFlush() { - outputQueue = []; - await videoEncodeProcessor.flush().then(() => { - console.info("case flush success"); - }, failCallback).catch(failCatch); - } - - async function toStop() { - await videoEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - } - - async function toReset() { - await videoEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - } - - async function toRelease() { - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_MULTIINSTANCE_0100 - * @tc.name : 001.create multiple encoders - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_MULTIINSTANCE_0100', 0, async function (done) { - console.info("case test multiple encoder instances"); - let savepath = BASIC_PATH + '0100.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - let array = new Array(); - - eventEmitter.once('nextStep', async () => { - for (let j = 1; j < 3; j++) { - await array[j].release().then(() => { - console.info("case release encoder " + j); - }, failCallback).catch(failCatch); - array[j] = null; - } - console.info('release encoders success'); - done(); - }); - async function runCase() { - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, function(){eventEmitter.emit('nextStep')}); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - } - for (let i = 1; i <= 3; i += 1) { - await media.createVideoEncoderByMime(mime).then((processor) => { - if (typeof(processor) != 'undefined') { - console.info("case create createVideoEncoder success: " + i); - if (i == 3) { - videoEncodeProcessor = processor; - runCase(); - } else { - array[i] = processor; - } - } else { - console.info("case create createVideoEncoder failed: " + i); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } - }) -}) - - \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js deleted file mode 100644 index b7a67b1b6c3559b503a3346c7c69580ad6b4cde1..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncCallbackTest.test.js +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import mediademo from '@ohos.multimedia.mediademo' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('VideoEncoderSoftwareFuncCallbackTest', function () { - let videoEncodeProcessor = null; - let mediaTest; - let surfaceID = ''; - let frameCountOut = 0; - let outputQueue = []; - let frameTotal = 100; - let finalFrameId = 100; - let reStart = false; - let isStreamRunning = false; - let stopBuffer = false; - const events = require('events'); - const eventEmitter = new events.EventEmitter(); - const ROOT = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/'; - const BASIC_PATH = ROOT + 'video_func_callback_'; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - mediaTest = null; - surfaceID = ''; - frameCountOut = 0; - outputQueue = []; - frameTotal = 100; - finalFrameId = 100; - reStart = false; - isStreamRunning = false; - stopBuffer = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoEncodeProcessor != null) { - await videoEncodeProcessor.release().then(() => { - console.info('case videoEncodeProcessor release'); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let failCallback = function(err) { - console.error(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - 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 writeFile(path, buf, len){ - try { - let writestream = Fileio.createStreamSync(path, 'ab+'); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.error('in case error writeFile: ' + e); - } - } - - async function dequeueOutputs(path, nextStep) { - while (outputQueue.length > 0) { - let outputObject = outputQueue.shift(); - if (outputObject.flags == 1 || frameCountOut == frameTotal || frameCountOut == finalFrameId) { - nextStep(); - return; - } - frameCountOut++; - writeFile(path, outputObject.data, outputObject.length); - videoEncodeProcessor.freeOutputBuffer(outputObject, (err) => { - if (typeof(err) == 'undefined') { - console.log('in case release output count:' + frameCountOut); - } else { - console.info(`in case release output called,errMessage is ${err.message}`); - } - }); - } - } - function printDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('video encoder key is ' + item); - console.info('video encoder value is ' + property); - } - } - function setCallback(path, nextStep) { - console.info('case callback'); - videoEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - if (stopBuffer == false) { - outputQueue.push(outBuffer); - dequeueOutputs(path, nextStep); - } - }); - - videoEncodeProcessor.on('error',(err) => { - console.info('in case error called, errName is' + err); - }); - videoEncodeProcessor.on('streamChanged',(format) => { - if (typeof(format) != undefined) { - printDescription(format); - } - }); - } - function toCreateStream() { - mediaTest = mediademo.createMediaTest(); - } - function toSetStreamParam(width, height, framerate, frameTotal) { - mediaTest.setResolution(width, height); - mediaTest.setFrameRate(framerate); - mediaTest.setFrameCount(frameTotal); - } - - function toStartStream() { - if (isStreamRunning == false) { - console.info('in case : toStartStream'); - mediaTest.startStream(surfaceID); - isStreamRunning = true; - } - } - - function toStopStream() { - if (isStreamRunning == true) { - console.info('in case : toStopStream'); - mediaTest.closeStream(surfaceID); - isStreamRunning = false; - } - } - - eventEmitter.on('configure', (mediaDescription, decPath, nextStep, done) => { - console.info('in case : configure in'); - videoEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info('in case : configure success'); - setCallback(decPath, nextStep); - eventEmitter.emit('getVideoEncoderCaps', done); - }); - }); - eventEmitter.on('getVideoEncoderCaps', (done) => { - videoEncodeProcessor.getVideoEncoderCaps((err, videoCaps) => { - expect(err).assertUndefined(); - console.info("case get getVideoEncoderCaps success"); - console.info(`print videoCaps: - codecInfo.name ${videoCaps.codecInfo.name} - codecInfo.type ${videoCaps.codecInfo.type} - codecInfo.mimeType ${videoCaps.codecInfo.mimeType} - codecInfo.isHardwareAccelerated ${videoCaps.codecInfo.isHardwareAccelerated} - codecInfo.isSoftwareOnly ${videoCaps.codecInfo.isSoftwareOnly} - codecInfo.isVendor ${videoCaps.codecInfo.isVendor} - supportedBitrate [${videoCaps.supportedBitrate.min}, ${videoCaps.supportedBitrate.max}] - supportedFormats ${videoCaps.supportedFormats} - supportedHeightAlignment ${videoCaps.supportedHeightAlignment} - supportedWidthAlignment ${videoCaps.supportedWidthAlignment} - supportedWidth [${videoCaps.supportedWidth.min}, ${videoCaps.supportedWidth.max}] - supportedHeight [${videoCaps.supportedHeight.min}, ${videoCaps.supportedHeight.max}] - supportedProfiles ${videoCaps.supportedProfiles} - supportedLevels ${videoCaps.supportedLevels} - supportedBitrateMode ${videoCaps.supportedBitrateMode} - supportedQuality [${videoCaps.supportedQuality.min}, ${videoCaps.supportedQuality.max}] - supportedComplexity [${videoCaps.supportedComplexity.min}, ${videoCaps.supportedComplexity.max}] - `); - eventEmitter.emit('getInputSurface', done); - }); - }); - eventEmitter.on('getInputSurface', (done) => { - videoEncodeProcessor.getInputSurface((err, inputSurface) => { - expect(err).assertUndefined(); - expect(inputSurface != undefined).assertTrue(); - surfaceID = inputSurface; - console.info('in case : getInputSurface success, surfaceID ' + surfaceID); - eventEmitter.emit('prepare', done); - }) - }); - eventEmitter.on('prepare', (done) => { - videoEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info('in case : prepare success'); - toStartStream(); - eventEmitter.emit('start', done); - }); - }); - eventEmitter.on('start', (done) => { - toStartStream(); - videoEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info('in case : start success'); - }); - stopBuffer = false; - }); - eventEmitter.on('stop', (done) => { - videoEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - toStopStream(); - console.info('in case : stop success'); - if (reStart == true) { - frameCountOut = 0; - outputQueue = []; - reStart = false; - eventEmitter.emit('start', done); - } else { - eventEmitter.emit('reset', done); - } - }); - stopBuffer = true; - }); - eventEmitter.on('flush', (done) => { - videoEncodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info('in case : flush success'); - eventEmitter.emit('reset', done); - }); - }); - eventEmitter.on('reset', (done) => { - videoEncodeProcessor.reset((err) => { - toStopStream(); - expect(err).assertUndefined(); - console.info('in case : reset success'); - eventEmitter.emit('release', done); - }); - }); - eventEmitter.on('release', (done) => { - videoEncodeProcessor.release((err) => { - toStopStream(); - expect(err).assertUndefined(); - console.info('in case : release success'); - videoEncodeProcessor = null; - done(); - }); - }); - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_00_0100 - * @tc.name : 000.test stop after last frame and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_00_0100.es'; - let mime = 'video/mp4v-es'; - let mediaDescription = { - "codec_mime": 'video/mp4v-es', - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30, - } - media.getMediaCapability((err, mediaCaps) => { - expect(err).assertUndefined(); - console.info(`case getMediaCapability 1`); - mediaCaps.getVideoEncoderCaps((err, videoCapsArray) => { - expect(err).assertUndefined(); - console.info('getVideoDecoderCaps success'); - if (typeof (videoCapsArray) != 'undefined') { - console.info("case videoCapsArray" + videoCapsArray); - } else { - console.info("case videoCapsArray is not defined"); - expect().assertFail(); - done(); - } - }) - mediaCaps.findVideoEncoder(mediaDescription, (err, codecname) => { - expect(err).assertUndefined(); - console.info('findVideoEncoder success'); - if (typeof (codecname) != 'undefined') { - console.info("case codecname " + codecname); - } else { - console.info("case codecname is not defined"); - expect().assertFail(); - done(); - } - }) - }) - media.createVideoEncoderByMime(mime, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('stop', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0100 - * @tc.name : 000.test stop at running state and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0100.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - finalFrameId = 50; - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('stop', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0200 - * @tc.name : 000.test stop at end of stream and restart - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0200.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - reStart = true; - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('stop', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0300 - * @tc.name : 000.test stop at running state and restart - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0300.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - finalFrameId = 50; - reStart = true; - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('stop', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0400 - * @tc.name : 000.test flush at running state - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0400.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - finalFrameId = 50; - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('flush', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0500 - * @tc.name : 000.test flush at end of stream - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0500.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('flush', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0600 - * @tc.name : 000.test reconfigure - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0600', 0, async function (done) { - let decPath = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0600.es'; - let name= 'avenc_mpeg4'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - let decPath2 = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_CALLBACK_01_0600_2.es'; - let mediaDescription2 = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30.00, - } - eventEmitter.on('reset_for_callback_01_0600', (done) => { - videoEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info('in case : reset_for_callback_01_0600 success'); - toStopStream(); - surfaceID = ''; - frameCountOut = 0; - outputQueue = []; - isStreamRunning = false; - toSetStreamParam(mediaDescription2.width, mediaDescription2.height, - mediaDescription2.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription2, decPath2, - function(){eventEmitter.emit('stop', done);}, done); - }) - }) - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - console.info('case create createVideoEncoderByName success'); - videoEncodeProcessor = processor; - toCreateStream(); - toSetStreamParam(mediaDescription.width, mediaDescription.height, - mediaDescription.frame_rate, frameTotal); - eventEmitter.emit('configure', mediaDescription, decPath, - function(){eventEmitter.emit('reset_for_callback_01_0600', done);}, done); - } else { - console.info('case create createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }); - }) -}) diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js deleted file mode 100644 index 9337df2ac7336d8cae40e0b8795041f6dd1e7d33..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareFuncPromiseTest.test.js +++ /dev/null @@ -1,698 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import mediademo from '@ohos.multimedia.mediademo' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('videoSoftwareEncoderFuncPromise', function () { - const ROOT = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/'; - const BASIC_PATH = ROOT + 'video_func_promise_'; - let videoEncodeProcessor; - let mediaTest; - let surfaceID = ''; - let outputQueue = []; - let outputCnt = 0; - let frameTotal = 100; - let stopAtEOS = false; - let resetAtEOS = false; - let flushAtEOS = false; - let sawOutputEOS = false; - let needGetMediaDes = false; - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - mediaTest = null; - surfaceID = ''; - outputQueue = []; - outputCnt = 0; - frameTotal = 100; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoEncodeProcessor != null){ - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - expect(err).assertUndefined(); - } - - let failCatch = function(err) { - console.info('case catch err : ' + err); - expect(err).assertUndefined(); - } - - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - - function resetParam() { - outputQueue = []; - outputCnt = 0; - frameTotal = 100; - stopAtEOS = false; - resetAtEOS = false; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - } - - function writeFile(path, buf, len){ - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function dequeueOutputs(path, done) { - while (outputQueue.length > 0) { - let outputObject = outputQueue.shift(); - outputCnt += 1; - if (outputObject.flags == 1) { - console.info("last frame, make choice"); - mediaTest.closeStream(surfaceID); - sawOutputEOS = true; - if (stopAtEOS) { - await toStop(); - } else if (resetAtEOS) { - await toReset(); - } else if (flushAtEOS) { - await toFlush(); - } else { - await toReset(); - await toRelease(); - done(); - } - } else { - console.info('not last frame, write data to file'); - writeFile(path, outputObject.data, outputObject.length); - console.info("write to file success"); - videoEncodeProcessor.freeOutputBuffer(outputObject).then(() => { - console.info('release output success'); - }); - } - } - } - - function setCallback(path, done) { - console.info('case callback'); - videoEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - console.info('outBuffer.flags: ' + outBuffer.flags); - if (needGetMediaDes) { - videoEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes = false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - dequeueOutputs(path, done); - }); - - videoEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - videoEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - async function toCreateByMime(mime, done) { - await media.createVideoEncoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByMime success'); - } else { - console.info('in case : createVideoEncoderByMime fail'); - expect().assertFail(); - done(); - } - }) - } - - async function toCreateByName(name, done) { - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - } - - async function toGetVideoEncoderCaps(width, height) { - await videoEncodeProcessor.getVideoEncoderCaps().then((videoCaps) => { - console.info("case get getVideoEncoderCaps success"); - printVideoCaps(videoCaps, width, height); - }, failCallback).catch(failCatch); - } - - async function printVideoCaps(videoCaps, width, height) { - console.info(`print videoCaps: - codecInfo.name ${videoCaps.codecInfo.name} - codecInfo.type ${videoCaps.codecInfo.type} - codecInfo.mimeType ${videoCaps.codecInfo.mimeType} - codecInfo.isHardwareAccelerated ${videoCaps.codecInfo.isHardwareAccelerated} - codecInfo.isSoftwareOnly ${videoCaps.codecInfo.isSoftwareOnly} - codecInfo.isVendor ${videoCaps.codecInfo.isVendor} - supportedBitrate [${videoCaps.supportedBitrate.min}, ${videoCaps.supportedBitrate.max}] - supportedFormats ${videoCaps.supportedFormats} - supportedHeightAlignment ${videoCaps.supportedHeightAlignment} - supportedWidthAlignment ${videoCaps.supportedWidthAlignment} - supportedWidth [${videoCaps.supportedWidth.min}, ${videoCaps.supportedWidth.max}] - supportedHeight [${videoCaps.supportedHeight.min}, ${videoCaps.supportedHeight.max}] - supportedProfiles ${videoCaps.supportedProfiles} - supportedLevels ${videoCaps.supportedLevels} - supportedBitrateMode ${videoCaps.supportedBitrateMode} - supportedQuality [${videoCaps.supportedQuality.min}, ${videoCaps.supportedQuality.max}] - supportedComplexity [${videoCaps.supportedComplexity.min}, ${videoCaps.supportedComplexity.max}] - `); - await videoCaps.getPreferredFrameRate(width, height).then((valueRange) => { - console.info("case getPreferredFrameRate valueRange success"); - if (typeof (valueRange) != 'undefined') { - console.info('getPreferredFrameRate.min: ' + valueRange.min); - console.info('getPreferredFrameRate.max: ' + valueRange.max); - } else { - console.info('case getPreferredFrameRate valueRange is not defined'); - expect().assertFail(); - } - }, failCallback).catch(failCatch); - await videoCaps.getSupportedFrameRate(width, height).then((valueRange) => { - console.info("case getSupportedFrameRate valueRange success"); - if (typeof (valueRange) != 'undefined') { - console.info('getSupportedFrameRate.min: ' + valueRange.min); - console.info('getSupportedFrameRate.max: ' + valueRange.max); - } else { - console.info('case getSupportedFrameRate valueRange is not defined'); - expect().assertFail(); - } - }, failCallback).catch(failCatch); - await videoCaps.isSizeSupported(width, height).then((trueORfalse) => { - console.info("case isSizeSupported valueRange for width:" + width + ", height: " + height); - if (typeof (trueORfalse) != 'undefined') { - console.info('videoCaps.isSizeSupported: ' + trueORfalse); - } else { - console.info('case isSizeSupported is not defined'); - expect().assertFail(); - } - }, failCallback).catch(failCatch); - } - - function toCreateStream() { - mediaTest = mediademo.createMediaTest(); - } - - function toSetStreamParam(width, height, framerate, frameTotal) { - console.info('case set stream parameter'); - mediaTest.setResolution(width, height); - mediaTest.setFrameRate(framerate); - mediaTest.setFrameCount(frameTotal); - } - - async function toGetInputSurface() { - await videoEncodeProcessor.getInputSurface().then((inputSurface) => { - expect(inputSurface != undefined).assertTrue(); - console.info('case getInputSurface success'); - surfaceID = inputSurface; - }, failCallback).catch(failCatch); - } - - function toStartStream() { - console.info('case start stream'); - mediaTest.startStream(surfaceID); - } - - function toStopStream() { - console.info('case stop stream'); - mediaTest.closeStream(surfaceID); - } - - async function toConfigure(mediaDescription) { - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - } - - async function toPrepare() { - await videoEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - } - - async function toStart() { - await videoEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - } - - async function toFlush() { - outputQueue = []; - await videoEncodeProcessor.flush().then(() => { - console.info("case flush success"); - }, failCallback).catch(failCatch); - } - - async function toStop() { - await videoEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - } - - async function toReset() { - resetParam(); - await videoEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - } - - async function toRelease() { - resetParam(); - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - videoEncodeProcessor = null; - }, failCallback).catch(failCatch); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_00_0100 - * @tc.name : 000.test stop after last frame and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_00_0100', 0, async function (done) { - console.info("case test stop after last frame"); - let savepath = BASIC_PATH + '0000.es'; - let name= 'avenc_mpeg4'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "codec_mime": 'video/mp4v-es', - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - await media.getMediaCapability().then((mediaCaps) => { - console.info('getMediaCapability success'); - if (typeof (mediaCaps) != 'undefined') { - mediaCaps.getVideoEncoderCaps().then((videoCapsArray) => { - console.info('getVideoEncoderCaps from media success'); - if (typeof (videoCapsArray) != 'undefined') { - let videoCaps = videoCapsArray[0]; - console.info('print first videoCaps from videoCapsArray'); - printVideoCaps(videoCaps, width, height); - } else { - console.info("case videoCapsArray is not defined"); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - mediaCaps.findVideoEncoder(mediaDescription).then((codecname) => { - console.info('findVideoEncoder success'); - if (typeof (codecname) != 'undefined') { - console.info("case codecname " + codecname); - } else { - console.info("case codecname is not defined"); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - } else { - console.info('mediaCaps is not defined'); - expect().assertFail(); - done(); - } - }, failCallback).catch(failCatch); - await toCreateByName(name, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0100 - * @tc.name : 001.test stop at runnning state and reset - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0100', 0, async function (done) { - console.info("case test stop at runnning state and reset"); - let savepath = BASIC_PATH + '0100.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(1000); - await toStop(); - toStopStream(); - await toReset(); - await toRelease(); - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0200 - * @tc.name : 002.test stop at end of stream and restart - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0200', 0, async function (done) { - console.info("test stop at end of stream and restart"); - let savepath = BASIC_PATH + '0200.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - frameTotal = 10; - stopAtEOS = true; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(5000); - resetParam(); - toSetStreamParam(width, height, framerate, frameTotal); - await toStart(); - toStartStream(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0300 - * @tc.name : 003.test stop at running state and restart - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0300', 0, async function (done) { - console.info("test stop at runnning state and restart"); - let savepath = BASIC_PATH + '0300.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - frameTotal = 1000; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(500); - toStopStream(); - await toStop(); - resetParam(); - toSetStreamParam(width, height, framerate, frameTotal); - await toStart(); - toStartStream(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0400 - * @tc.name : 004.test flush at running state - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0400', 0, async function (done) { - console.info("case test flush at running state"); - let savepath = BASIC_PATH + '0400.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - frameTotal = 500; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(500); - await toFlush(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0500 - * @tc.name : 005.test flush at end of stream - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0500', 0, async function (done) { - console.info("case test flush at end of stream"); - let savepath = BASIC_PATH + '0500.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - flushAtEOS = true; - frameTotal = 10; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(5000); - resetParam(); - toSetStreamParam(width, height, framerate, frameTotal); - toStartStream(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0600 - * @tc.name : 006.test reconfigure - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0600', 0, async function (done) { - console.info("case test reconfigure"); - let savepath = BASIC_PATH + '0600.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - resetAtEOS = true; - frameTotal = 10; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(5000); - resetParam(); - width = 320; - height = 240; - framerate = 30; - let mediaDescription2 = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - let savepath2 = BASIC_PATH + '0601.es'; - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription2); - setCallback(savepath2, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0700 - * @tc.name : 007.test recreate videoencoder - * @tc.desc : basic encode function - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_FUNCTION_PROMISE_01_0700', 0, async function (done) { - console.info("case test recreate videoencoder"); - let savepath = BASIC_PATH + '0700.es'; - let mime = 'video/mp4v-es'; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - resetAtEOS = true; - frameTotal = 10; - await toCreateByMime(mime, done); - await toGetVideoEncoderCaps(width, height); - toCreateStream(); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription); - setCallback(savepath, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - await sleep(5000); - await toRelease(); - resetParam(); - width = 320; - height = 240; - framerate = 30; - let mediaDescription2 = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - let savepath2 = BASIC_PATH + '0701.es'; - await toCreateByMime(mime, done); - toSetStreamParam(width, height, framerate, frameTotal); - await toConfigure(mediaDescription2); - setCallback(savepath2, done); - await toGetInputSurface(); - await toPrepare(); - toStartStream(); - await toStart(); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js deleted file mode 100644 index 8921b8da96671e8fd5baf41e11a0b6638cf6984f..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js +++ /dev/null @@ -1,1551 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import mediademo from '@ohos.multimedia.mediademo' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -export -const ENCODE_STEP = { - WAIT_FOR_EOS : 'encode:waitForEOS', - CONFIGURE : 'encode:configure', - GET_INPUTSURFACE : 'encode:getSurface', - PREPARE : 'encode:prepare', - START : 'encode:start', - FLUSH : 'encode:flush', - STOP : 'encode:stop', - RESET : 'encode:reset', - WAIT_FOR_ALL_OUTS : 'encode:waitForAllOuts', - ERROR : 'encode:error', - RELEASE : 'encode:release', -} -const STREAM_STEP = { - CREATE : 'stream:create', - PREPARE : 'stream:prepare', - SET_PARAM: 'stream:setParam', - SET_EOS_FRAME: 'stream:setEOSFrame', - START : 'stream:start', - STOP : 'stream:stop', -} -describe('VideoEncoderSoftwareReliCallbackTest', function () { - let videoEncodeProcessor = null; - let mediaTest = null; - let surfaceID = ''; - let frameCountOut = 0; - let outputQueue = []; - let frameTotal = 100; - let finalFrameId = 100; - let isStreamRunning = false; - let workdoneAtEOS = false; - let stopBuffer = false; - const ROOT = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/'; - const BASIC_PATH = ROOT + 'video_reliability_callback_'; - let mediaDescription = { - 'width': 320, - 'height': 240, - 'pixel_format': 3, - 'frame_rate': 30, - } - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - mediaTest = null; - surfaceID = ''; - frameCountOut = 0; - outputQueue = []; - workdoneAtEOS = false; - frameTotal = 100; - finalFrameId = 100; - isStreamRunning = false; - stopBuffer = false; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoEncodeProcessor != null) { - await videoEncodeProcessor.release().then(() => { - console.info('in case : videoEncodeProcessor release success'); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - toStopStream(); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - let failCallback = function(err) { - console.error(`in case error failCallback called, errMessage is ${err.message}`); - expect(err == undefined).assertTrue(); - } - let failCatch = function(err) { - 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) { - console.error('in case error failCatch called,err is ' + err); - console.error(`in case error failCatch called,errMessage is ${err.message}`); - } - } - - function writeFile(path, buf, len){ - try { - let writestream = Fileio.createStreamSync(path, 'ab+'); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.error('in case error writeFile: ' + e); - } - } - - /* get outputbuffers from codec */ - async function dequeueOutputs(path, nextStep) { - console.log('outputQueue.length:' + outputQueue.length); - while (outputQueue.length > 0){ - let outputObject = outputQueue.shift(); - if (outputObject.flags == 1 || frameCountOut == frameTotal) { - if (workdoneAtEOS) { - doneWork(nextStep); - } - return; - } - frameCountOut++; - writeFile(path, outputObject.data, outputObject.length); - videoEncodeProcessor.freeOutputBuffer(outputObject, (err) => { - if (typeof(err) == 'undefined') { - console.debug('in case release output count:' + frameCountOut); - } else { - console.info(`in case release output called,errMessage is ${err.message}`); - } - }) - } - } - function printDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('video encoder key is ' + item); - console.info('video encoder value is ' + property); - } - } - function setCallback(path, nextStep) { - videoEncodeProcessor.on('newOutputData', async (outBuffer) => { - console.info('in case: outputBufferAvailable outBuffer.index: '+ outBuffer.index); - if (stopBuffer == false) { - outputQueue.push(outBuffer); - dequeueOutputs(path, nextStep); - } - }); - - videoEncodeProcessor.on('error',(err) => { - console.info('in case: error called,errName is' + err); - }); - - videoEncodeProcessor.on('streamChanged', (format) => { - if (typeof(format) != undefined) { - printDescription(format); - } - }); - } - function toCreateStream(mySteps, done) { - mediaTest = mediademo.createMediaTest(); - toNextStep(mySteps, done); - } - function toSetStreamParam(mySteps, done) { - mediaTest.setResolution(mediaDescription.width, mediaDescription.height); - mediaTest.setFrameRate(mediaDescription.frame_rate); - toNextStep(mySteps, done); - } - function toSetEOSFrame(mySteps, done) { - mediaTest.setFrameCount(frameTotal); - toNextStep(mySteps, done); - } - function toStartStream(mySteps, done) { - if (isStreamRunning == false) { - console.info('in case : toStartStream'); - mediaTest.startStream(surfaceID); - isStreamRunning = true; - } - toNextStep(mySteps, done); - } - - function toStopStream(mySteps, done) { - if (isStreamRunning == true) { - console.info('in case : toStopStream'); - mediaTest.closeStream(surfaceID); - isStreamRunning = false; - } - toNextStep(mySteps, done); - } - function toConfigure(mySteps, done, expectFail) { - videoEncodeProcessor.configure(mediaDescription, (err) => { - console.info(`case configure callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }) - } - function toGetInputSurface(mySteps, done, expectFail) { - videoEncodeProcessor.getInputSurface((err, inputSurface) => { - expect(err).assertUndefined(); - expect(inputSurface != undefined).assertTrue(); - printError(err, expectFail); - surfaceID = inputSurface; - console.info('in case : getInputSurface success, surfaceID ' + surfaceID); - toNextStep(mySteps, done); - }) - } - function toPrepare(mySteps, done, expectFail) { - videoEncodeProcessor.prepare((err) => { - console.info(`case prepare callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toStart(mySteps, done, expectFail) { - videoEncodeProcessor.start((err) => { - console.info(`case start callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - stopBuffer = false; - } - function toStop(mySteps, done, expectFail) { - videoEncodeProcessor.stop((err) => { - console.info(`case stop callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - stopBuffer = true; - } - function toFlush(mySteps, done, expectFail) { - videoEncodeProcessor.flush((err) => { - console.info(`case flush callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function toReset(mySteps, done, expectFail) { - videoEncodeProcessor.reset((err) => { - console.info(`case reset callback`); - printError(err, expectFail); - toNextStep(mySteps, done); - }); - } - function runCase(mySteps, nextCase, done) { - if (mySteps[0] == ENCODE_STEP.ERROR) { - mySteps.shift(); - nextCase(mySteps, done, true); - } else { - nextCase(mySteps, done, false); - } - } - function toNextStep(mySteps, done) { - console.info('case myStep[0]: ' + mySteps[0]); - if (mySteps[0] == ENCODE_STEP.RELEASE) { - if (videoEncodeProcessor != null){ - videoEncodeProcessor.release((err) => { - printError(err, false); - console.info('in case : videoEncodeProcessor release callback'); - videoEncodeProcessor = null; - console.info('case to done'); - done(); - }); - } - return; - } - switch (mySteps[0]) { - case ENCODE_STEP.CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - runCase(mySteps, toConfigure, done); - break; - case STREAM_STEP.CREATE: - mySteps.shift(); - console.info(`case to createStream`); - toCreateStream(mySteps, done); - break; - case STREAM_STEP.SET_PARAM: - mySteps.shift(); - console.info(`case to SetStreamParam`); - toSetStreamParam(mySteps, done); - break; - case STREAM_STEP.SET_EOS_FRAME: - mySteps.shift(); - console.info(`case to SetEOSFrame`); - toSetEOSFrame(mySteps, done); - break; - case STREAM_STEP.START: - mySteps.shift(); - console.info(`case to StartStream`); - toStartStream(mySteps, done); - break; - case STREAM_STEP.STOP: - mySteps.shift(); - console.info(`case to StoptStream`); - toStopStream(mySteps, done); - break; - case ENCODE_STEP.GET_INPUTSURFACE: - mySteps.shift(); - console.info(`case to setOutputSurface`); - runCase(mySteps, toGetInputSurface, done); - break; - case ENCODE_STEP.PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - runCase(mySteps, toPrepare, done); - break; - case ENCODE_STEP.START: - mySteps.shift(); - console.info(`case to start`); - runCase(mySteps, toStart, done); - break; - case ENCODE_STEP.FLUSH: - mySteps.shift(); - console.info(`case to flush`); - runCase(mySteps, toFlush, done); - break; - case ENCODE_STEP.STOP: - mySteps.shift(); - console.info(`case to stop`); - runCase(mySteps, toStop, done); - break; - case ENCODE_STEP.RESET: - mySteps.shift(); - console.info(`case to reset`); - runCase(mySteps, toReset, done); - break; - case ENCODE_STEP.WAIT_FOR_EOS: - mySteps.shift(); - setTimeout(() =>{ - toNextStep(mySteps, done); - }, 5000); // wait 5000 ms for eos - break; - case ENCODE_STEP.WAIT_FOR_ALL_OUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - default: - break; - } - } - - function toCreateVideoEncoderByMime(mime, path, mySteps, done) { - media.createVideoEncoderByMime(mime, (err, processor) => { - console.info(`case createVideoEncoderByMime callback`); - printError(err, false); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - setCallback(path, done); - toNextStep(mySteps, done); - } else { - done(); - } - }) - } - function toCreateVideoEncoderByName(name, path, mySteps, done) { - media.createVideoEncoderByName(name, (err, processor) => { - printError(err, false); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - setCallback(path, done); - toNextStep(mySteps, done); - } else { - done(); - } - }) - } - async function doneWork(nextStep) { - videoEncodeProcessor.stop((err) => { - printError(err, false); - console.info('case stop callback'); - mediaTest.closeStream(surfaceID); - videoEncodeProcessor.reset((err) => { - printError(err, false); - console.info('case reset callback'); - videoEncodeProcessor.release((err) => { - printError(err, false); - console.info('case release callback'); - videoEncodeProcessor = null; - nextStep(); - }) - }) - }) - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0100 - * @tc.name : 001.create -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.CONFIGURE, ENCODE_STEP.ERROR, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0300 - * @tc.name : 003.start -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.CONFIGURE, ENCODE_STEP.ERROR, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.CONFIGURE, ENCODE_STEP.ERROR, STREAM_STEP.STOP, - ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.CONFIGURE, ENCODE_STEP.ERROR, STREAM_STEP.STOP, - ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.CONFIGURE, ENCODE_STEP.ERROR, - STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.CONFIGURE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.CONFIGURE, - ENCODE_STEP.ERROR, ENCODE_STEP.PREPARE, ENCODE_STEP.START, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability test - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0900', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_CALLBACK_0900.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.CONFIGURE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.PREPARE, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.PREPARE, ENCODE_STEP.ERROR, ENCODE_STEP.START, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.PREPARE, ENCODE_STEP.ERROR, - ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.PREPARE, - ENCODE_STEP.ERROR, ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.PREPARE, - ENCODE_STEP.ERROR, ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.PREPARE, - ENCODE_STEP.ERROR, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.PREPARE, - ENCODE_STEP.ERROR, ENCODE_STEP.RESET, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0100 - * @tc.name : 001.create -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.START, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0200 - * @tc.name : 002.configure -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.START, - ENCODE_STEP.ERROR, STREAM_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0400 - * @tc.name : 004.start -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.START, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0500 - * @tc.name : 005.flush -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, ENCODE_STEP.PREPARE, - ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.START, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0600 - * @tc.name : 006.stop -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.START, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.START, - ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0800 - * @tc.name : 008.reset -> start - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.START, - ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0100 - * @tc.name : 001.create -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.FLUSH, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, - STREAM_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.FLUSH, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0400 - * @tc.name : 004.start -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.FLUSH, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP , ENCODE_STEP.FLUSH, - ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.FLUSH, - ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.FLUSH, - ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0100 - * @tc.name : 001.create -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.STOP, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, STREAM_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.STOP, ENCODE_STEP.ERROR, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0400 - * @tc.name : 004.start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.STOP, - ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.STOP, ENCODE_STEP.ERROR, - ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.STOP, - ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.STOP, ENCODE_STEP.ERROR, - ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0100 - * @tc.name : 001.create -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, - STREAM_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0400 - * @tc.name : 004.start -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.FLUSH, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0600', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0600.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0700', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0700.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0800', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_CALLBACK_0800.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.RESET, ENCODE_STEP.RESET, ENCODE_STEP.RELEASE); - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0100', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0100.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.FLUSH, - ENCODE_STEP.STOP, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0200', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0200.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.FLUSH, - ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0300', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0300.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.RESET, - ENCODE_STEP.CONFIGURE, STREAM_STEP.STOP, STREAM_STEP.SET_PARAM, STREAM_STEP.SET_EOS_FRAME, - STREAM_STEP.START, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0400', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0400.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.STOP, - ENCODE_STEP.START, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : test for state transition - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0500', 0, async function (done) { - let path = BASIC_PATH + 'SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_CALLBACK_0500.es'; - let mySteps = new Array(ENCODE_STEP.CONFIGURE, STREAM_STEP.CREATE, STREAM_STEP.SET_PARAM, - STREAM_STEP.SET_EOS_FRAME, ENCODE_STEP.GET_INPUTSURFACE, STREAM_STEP.START, - ENCODE_STEP.PREPARE, ENCODE_STEP.START, ENCODE_STEP.WAIT_FOR_EOS, ENCODE_STEP.STOP, - ENCODE_STEP.START, ENCODE_STEP.STOP, ENCODE_STEP.RELEASE); - frameTotal = 50; - toCreateVideoEncoderByName('avenc_mpeg4', path, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE-RESET_CALLBACK_0100 - * @tc.name : 001. configure -> reset for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE-RESET_CALLBACK_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let loopCnt = 0; - eventEmitter.on('configure', (mediaDescription) => { - videoEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - eventEmitter.emit('reset'); - }) - }); - eventEmitter.on('reset', () => { - videoEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info(`case reset 1`); - loopCnt += 1; - if (loopCnt < 50) { - console.info('case configure-reset current loop: ' + loopCnt); - eventEmitter.emit('configure', mediaDescription); - } else { - videoEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info('case release callback'); - videoEncodeProcessor = null; - done(); - }) - } - }) - }); - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START-STOP_CALLBACK_0100 - * @tc.name : 001. start -> stop for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START-STOP_CALLBACK_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let loopCnt = 0; - eventEmitter.on('configure', (mediaDescription) => { - videoEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - eventEmitter.emit('getInputSurface'); - }) - }); - eventEmitter.on('getInputSurface', () => { - videoEncodeProcessor.getInputSurface((err, inputSurface) => { - expect(err).assertUndefined(); - expect(inputSurface != undefined).assertTrue(); - surfaceID = inputSurface; - console.info('in case : getInputSurface success, surfaceID ' + surfaceID); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - videoEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info('in case : prepare success'); - eventEmitter.emit('start'); - }); - }); - eventEmitter.on('start', () => { - videoEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info('in case : start success'); - eventEmitter.emit('stop'); - }); - }); - eventEmitter.on('stop', () => { - videoEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info(`case stop 1`); - loopCnt += 1; - if (loopCnt < 50) { - console.info('case start-stop current loop: ' + loopCnt); - eventEmitter.emit('start'); - } else { - videoEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info('case release callback'); - videoEncodeProcessor = null; - done(); - }) - } - }) - }); - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CREATE-RELEASE_CALLBACK_0100 - * @tc.name : 001. create -> release for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CREATE-RELEASE_CALLBACK_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let loopCnt = 0; - eventEmitter.on('create', (name) => { - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - eventEmitter.emit('release'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - }) - eventEmitter.on('release', () => { - videoEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info(`case release 1`); - videoEncodeProcessor = null; - loopCnt += 1; - if (loopCnt < 50) { - console.info('case create-release current loop: ' + loopCnt); - eventEmitter.emit('create', name); - } else { - done(); - } - }) - }) - eventEmitter.emit('create', name); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_TOTALLOOP_CALLBACK_0100 - * @tc.name : 001. total loop for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_TOTALLOOP_CALLBACK_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - let events = require('events'); - let eventEmitter = new events.EventEmitter(); - let loopCnt = 0; - eventEmitter.on('create', (name) => { - media.createVideoEncoderByName(name, (err, processor) => { - expect(err).assertUndefined(); - if (typeof(processor) != 'undefined') { - videoEncodeProcessor = processor; - eventEmitter.emit('configure', mediaDescription); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - }) - eventEmitter.on('configure', (mediaDescription) => { - videoEncodeProcessor.configure(mediaDescription, (err) => { - expect(err).assertUndefined(); - console.info(`case configure 1`); - eventEmitter.emit('getInputSurface'); - }) - }); - eventEmitter.on('getInputSurface', () => { - videoEncodeProcessor.getInputSurface((err, inputSurface) => { - expect(err).assertUndefined(); - expect(inputSurface != undefined).assertTrue(); - surfaceID = inputSurface; - console.info('in case : getInputSurface success, surfaceID ' + surfaceID); - eventEmitter.emit('prepare'); - }) - }); - eventEmitter.on('prepare', () => { - videoEncodeProcessor.prepare((err) => { - expect(err).assertUndefined(); - console.info('in case : prepare success'); - eventEmitter.emit('start'); - }); - }); - eventEmitter.on('start', () => { - videoEncodeProcessor.start((err) => { - expect(err).assertUndefined(); - console.info('in case : start success'); - eventEmitter.emit('flush'); - }); - }); - eventEmitter.on('flush', () => { - videoEncodeProcessor.flush((err) => { - expect(err).assertUndefined(); - console.info('in case : flush success'); - eventEmitter.emit('stop'); - }); - }); - eventEmitter.on('stop', () => { - videoEncodeProcessor.stop((err) => { - expect(err).assertUndefined(); - console.info('in case : stop success'); - eventEmitter.emit('reset'); - }); - }); - eventEmitter.on('reset', () => { - videoEncodeProcessor.reset((err) => { - expect(err).assertUndefined(); - console.info('in case : reset success'); - eventEmitter.emit('release'); - }); - }); - eventEmitter.on('release', () => { - videoEncodeProcessor.release((err) => { - expect(err).assertUndefined(); - console.info(`case release 1`); - videoEncodeProcessor = null; - loopCnt += 1; - if (loopCnt < 50) { - console.info('case create-release current loop: ' + loopCnt); - eventEmitter.emit('create', name); - } else { - done(); - } - }) - }) - eventEmitter.emit('create', name); - }) -}) - diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js deleted file mode 100644 index 00555114c5f2aeada6f391d3182070e7ba8ea1d3..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityPromiseTest.test.js +++ /dev/null @@ -1,1524 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import mediademo from '@ohos.multimedia.mediademo' -import Fileio from '@ohos.fileio' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('videoEncoderReliabilityPromise', function () { - const ROOT = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoencoder/results/'; - const BASIC_PATH = ROOT + 'video_reliability_promise_'; - let videoEncodeProcessor; - let mediaTest = mediademo.createMediaTest(); - let surfaceID = ''; - let outputQueue = []; - let outputCnt = 0; - let frameTotal = 100; - let frameCountOut = 0; - let flushAtEOS = false; - let sawOutputEOS = false; - let needGetMediaDes = false; - let workdoneAtEOS = false; - const END = 0; - const CONFIGURE = 1; - const GETSURFACE = 2; - const SETSTREAMPARAM = 3; - const PREPARE = 4; - const STARTSTREAM = 5; - const STOPSTREAM = 6; - const START = 7; - const FLUSH = 8; - const STOP = 9; - const RESET = 10; - const RELEASE = 11; - const HOLDON = 12; - const ERROR = 13; - const WAITFORALLOUTS = 14; - const JUDGE_EOS = 15; - const WAITTIME = 3000; - let width = 320; - let height = 240; - let framerate = 30; - let mediaDescription = { - "width": width, - "height": height, - "pixel_format": 3, - "frame_rate" : framerate, - } - let mime = 'video/mp4v-es'; - - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(async function() { - console.info('beforeEach case'); - await msleep(1000).then(() => { - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - surfaceID = ''; - outputQueue = []; - outputCnt = 0; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - workdoneAtEOS = false; - width = 320; - height = 240; - framerate = 30; - frameTotal = 100; - }) - - afterEach(async function() { - console.info('afterEach case'); - if (videoEncodeProcessor != null) { - await videoEncodeProcessor.release().then(() => { - console.info(`case release 1`); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - let failCallback = function(err) { - console.info('case callback err : ' + err); - 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(); - } - - function msleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - - function resetParam() { - outputQueue = []; - outputCnt = 0; - frameTotal = 100; - flushAtEOS = false; - sawOutputEOS = false; - needGetMediaDes = false; - workdoneAtEOS = false; - } - - function writeFile(path, buf, len){ - try{ - let writestream = Fileio.createStreamSync(path, "ab+"); - let num = writestream.writeSync(buf, {length:len}); - writestream.flushSync(); - writestream.closeSync(); - } catch(e) { - console.info(e) - } - } - - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)); - } - - function wait(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - - async function nextStep(mySteps, done) { - console.info("case myStep[0]: " + mySteps[0]); - if (mySteps[0] == END) { - done(); - } - switch (mySteps[0]) { - case CONFIGURE: - mySteps.shift(); - console.info(`case to configure`); - await toConfigure(mySteps, done); - break; - case GETSURFACE: - mySteps.shift(); - console.info(`case to getInputSurface`); - await toGetInputSurface(); - nextStep(mySteps, done); - break; - case SETSTREAMPARAM: - mySteps.shift(); - toSetStreamParam(); - nextStep(mySteps, done); - break; - case PREPARE: - mySteps.shift(); - console.info(`case to prepare`); - await toPrepare(mySteps, done); - break; - case STARTSTREAM: - mySteps.shift(); - console.info(`case to start stream`); - toStartStream(); - nextStep(mySteps, done); - break; - case STOPSTREAM: - mySteps.shift(); - console.info(`case to stop stream`); - mediaTest.closeStream(surfaceID); - nextStep(mySteps, done); - break; - case START: - mySteps.shift(); - console.info(`case to start`); - await toStart(mySteps, done); - break; - case FLUSH: - mySteps.shift(); - console.info(`case to flush`); - await toFlush(mySteps, done); - break; - case STOP: - mySteps.shift(); - console.info(`case to stop`); - await toStop(mySteps, done); - break; - case RESET: - mySteps.shift(); - console.info(`case to reset`); - await toReset(); - nextStep(mySteps, done); - break; - case RELEASE: - mySteps.shift(); - console.info(`case to release`); - await toRelease(mySteps, done); - break; - case HOLDON: - mySteps.shift(); - setTimeout(() => { - nextStep(mySteps, done); - }, WAITTIME); - break; - case WAITFORALLOUTS: - mySteps.shift(); - console.info(`case wait for all outputs`); - break; - case JUDGE_EOS: - mySteps.shift(); - console.info(`case judge EOS state`); - expect(sawOutputEOS).assertTrue(); - nextStep(mySteps, done); - break; - default: - break; - } - } - async function dequeueOutputs(path, done) { - while (outputQueue.length > 0) { - let outputObject = outputQueue.shift(); - outputCnt += 1; - if (outputObject.flags == 1) { - console.info("saw output EOS"); - sawOutputEOS = true; - if (workdoneAtEOS) { - mediaTest.closeStream(surfaceID); - await toReset(); - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - done(); - } else { - console.info("sawOutputEOS = true;"); - } - } else { - writeFile(path, outputObject.data, outputObject.length); - console.info("write to file success"); - videoEncodeProcessor.freeOutputBuffer(outputObject).then(() => { - console.info('release output success'); - frameCountOut++; - console.log('release output count:' + frameCountOut); - }) - } - } - } - - function setCallback(path, done) { - console.info('case callback'); - videoEncodeProcessor.on('newOutputData', async(outBuffer) => { - console.info('outputBufferAvailable'); - console.info('outBuffer.flags :' + outBuffer.flags); - if (needGetMediaDes) { - videoEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => { - console.info("get OutputMediaDescription success"); - console.info('get outputMediaDescription : ' + MediaDescription); - needGetMediaDes = false; - }, failCallback).catch(failCatch); - } - outputQueue.push(outBuffer); - await dequeueOutputs(path, done); - }); - - videoEncodeProcessor.on('error',(err) => { - console.info('case error called,errName is' + err); - }); - videoEncodeProcessor.on('streamChanged',(format) => { - console.info('Output format changed: ' + format); - }); - } - - async function createVideoEncoder(savepath, mySteps, done) { - await media.createVideoEncoderByMime(mime).then((processor) => { - console.info(`case createVideoEncoder 1`); - videoEncodeProcessor = processor; - setCallback(savepath, done); - console.info("case start api test"); - nextStep(mySteps, done); - }, failCallback).catch(failCatch); - } - - async function toCreateByMime(mime, done) { - await media.createVideoEncoderByMime(mime).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByMime success'); - } else { - console.info('in case : createVideoEncoderByMime fail'); - expect().assertFail(); - done(); - } - }) - } - - function toSetStreamParam() { - mediaTest.setResolution(width, height); - mediaTest.setFrameRate(framerate); - mediaTest.setFrameCount(frameTotal); - } - - async function toGetInputSurface() { - await videoEncodeProcessor.getInputSurface().then((inputSurface) => { - expect(inputSurface != undefined).assertTrue(); - surfaceID = inputSurface; - }, failCallback).catch(failCatch); - } - - function toStartStream() { - mediaTest.isStart = 1; - mediaTest.startStream(surfaceID); - } - - async function toConfigure(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to configure 2`); - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info(`case configure error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - } else { - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - } - nextStep(mySteps, done); - } - - async function toPrepare(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to prepare 2`); - await videoEncodeProcessor.prepare().then(() => { - console.info(`case prepare error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - } else { - await videoEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - } - nextStep(mySteps, done); - } - - async function toStart(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to start 2`); - await videoEncodeProcessor.start().then(() => { - console.info(`case start error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - } else { - if (sawOutputEOS) { - resetParam(); - workdoneAtEOS = true; - } - await videoEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - } - nextStep(mySteps, done); - } - - async function toFlush(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to flush 2`); - await videoEncodeProcessor.flush().then(() => { - console.info(`case flush error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - } else { - await videoEncodeProcessor.flush().then(() => { - console.info("case flush success"); - }, failCallback).catch(failCatch); - if (flushAtEOS) { - mediaTest.closeStream(surfaceID); - resetParam(); - workdoneAtEOS = true; - } - } - nextStep(mySteps, done); - } - - async function toStop(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to stop 2`); - await videoEncodeProcessor.stop().then(() => { - console.info(`case stop error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - } else { - await videoEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - } - nextStep(mySteps, done); - } - - async function toReset() { - await videoEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - } - - async function toRelease(mySteps, done) { - if (mySteps[0] == ERROR) { - mySteps.shift(); - console.info(`case to relase 2`); - await videoEncodeProcessor.release().then(() => { - console.info(`case release error 1`); - expect().assertFail(); - }, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch); - videoEncodeProcessor = null; - } else { - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - if (mySteps[0] != RELEASE) { - videoEncodeProcessor = null; - } - } - nextStep(mySteps, done); - } - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0100 - * @tc.name : 001.create -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0100.es'; - let mySteps = new Array(CONFIGURE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0200 - * @tc.name : 002.prepare -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0200.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, CONFIGURE, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0300 - * @tc.name : 003.start -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, - CONFIGURE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0400 - * @tc.name : 004.flush -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, - CONFIGURE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0500 - * @tc.name : 005.stop -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP , - CONFIGURE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0600 - * @tc.name : 006.EOS -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, CONFIGURE, ERROR, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0700 - * @tc.name : 007.reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0700.es'; - let mySteps = new Array(RESET, CONFIGURE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0800 - * @tc.name : 008.configure -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0800.es'; - let mySteps = new Array(CONFIGURE, CONFIGURE, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0900 - * @tc.name : 009.configure -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_PROMISE_0900', 0, async function (done) { - let savepath = BASIC_PATH + 'configure_0900.es'; - let mySteps = new Array(CONFIGURE, RESET, CONFIGURE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0100 - * @tc.name : 001.create -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0100.es'; - let mySteps = new Array(PREPARE, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0200 - * @tc.name : 002.configure -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0200.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0300 - * @tc.name : 003.prepare -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, PREPARE, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0400 - * @tc.name : 004.start -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, PREPARE, ERROR, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0500 - * @tc.name : 005.flush -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, - PREPARE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0600 - * @tc.name : 006.stop -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - PREPARE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0700 - * @tc.name : 007.EOS -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, PREPARE, ERROR, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0800 - * @tc.name : 008.reset -> prepare - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_PREPARE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'prepare_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - PREPARE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0100 - * @tc.name : 001.create -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0100.es'; - let mySteps = new Array(START, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0200 - * @tc.name : 002.configure -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0200.es'; - let mySteps = new Array(CONFIGURE, START, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0300 - * @tc.name : 003.prepare -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, WAITFORALLOUTS); - workdoneAtEOS = true; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0400 - * @tc.name : 004.start -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, START, ERROR, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0500 - * @tc.name : 005.flush -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, - START, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0600 - * @tc.name : 006.stop -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - START, WAITFORALLOUTS); - workdoneAtEOS = true; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0700 - * @tc.name : 007.EOS -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, START, ERROR, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0800 - * @tc.name : 008.reset -> start - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'start_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - START, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0100 - * @tc.name : 001.create -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0100.es'; - let mySteps = new Array(FLUSH, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0200 - * @tc.name : 002.configure -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0200.es'; - let mySteps = new Array(CONFIGURE, FLUSH, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0300 - * @tc.name : 003.prepare -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, FLUSH, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0400 - * @tc.name : 004.start -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, FLUSH, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0500 - * @tc.name : 005.flush -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, FLUSH, - WAITFORALLOUTS); - workdoneAtEOS = true; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0600 - * @tc.name : 006.stop -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - FLUSH, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0700 - * @tc.name : 007.EOS -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, FLUSH, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0800 - * @tc.name : 008.reset -> flush - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_FLUSH_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'flush_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - FLUSH, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0100 - * @tc.name : 001.create -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0100.es'; - let mySteps = new Array(STOP, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0200 - * @tc.name : 002.configure -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0200.es'; - let mySteps = new Array(CONFIGURE, STOP, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0300 - * @tc.name : 003.prepare -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STOP, ERROR, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0400 - * @tc.name : 004.start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0500 - * @tc.name : 005.flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, STOP, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0600 - * @tc.name : 006.stop -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, STOP, ERROR, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0700 - * @tc.name : 007.EOS -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, JUDGE_EOS, - STOP, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0800 - * @tc.name : 008.reset -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_STOP_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'stop_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - STOP, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0100 - * @tc.name : 001.create -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0100.es'; - let mySteps = new Array(RESET, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0200 - * @tc.name : 002.configure -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0200.es'; - let mySteps = new Array(CONFIGURE, RESET, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0300 - * @tc.name : 003.prepare -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, RESET, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0400 - * @tc.name : 004.start -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0500 - * @tc.name : 005.flush -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, - RESET, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0600 - * @tc.name : 006.stop -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - RESET, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0700 - * @tc.name : 007.EOS -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, RESET, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0800 - * @tc.name : 008.reset -> reset - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RESET_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'reset_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RESET, - RESET, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0100 - * @tc.name : 001.create -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0100.es'; - let mySteps = new Array(RELEASE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0200 - * @tc.name : 002.configure -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0200.es'; - let mySteps = new Array(CONFIGURE, RELEASE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0300 - * @tc.name : 003.prepare -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, RELEASE, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0400 - * @tc.name : 004.start -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, - RELEASE, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0500 - * @tc.name : 005.flush -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0500', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0500.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, FLUSH, - RELEASE, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0600 - * @tc.name : 006.stop -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0600', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0600.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, STOP, - RELEASE, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0700 - * @tc.name : 007.EOS -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0700', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0700.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, RELEASE, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0800 - * @tc.name : 008.release -> release - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_RELEASE_PROMISE_0800', 0, async function (done) { - let savepath = BASIC_PATH + 'release_0800.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, STARTSTREAM, START, RELEASE, - RELEASE, ERROR, STOPSTREAM, END); - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0100 - * @tc.name : 001.EOS -> flush -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0100', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0100.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, FLUSH, STOP, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0200 - * @tc.name : 002.EOS -> flush -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0200', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0200.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, FLUSH, STARTSTREAM, WAITFORALLOUTS); - frameTotal = 2; - flushAtEOS = true; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0300 - * @tc.name : 003.EOS -> reset -> configure - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0300', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0300.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, RESET, CONFIGURE, STOPSTREAM, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0400 - * @tc.name : 004.EOS -> stop -> start -> EOS - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0400', 0, async function (done) { - let savepath = BASIC_PATH + 'eos_0400.es'; - let mySteps = new Array(CONFIGURE, GETSURFACE, SETSTREAMPARAM, PREPARE, START, STARTSTREAM, HOLDON, - JUDGE_EOS, STOPSTREAM, STOP, START, SETSTREAMPARAM, STARTSTREAM, WAITFORALLOUTS); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_EOS_PROMISE_0500 - * @tc.name : 005.EOS -> stop -> start -> stop - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - 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, RELEASE, END); - frameTotal = 2; - createVideoEncoder(savepath, mySteps, done); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE-RESET_PROMISE_0100 - * @tc.name : 001. configure -> reset for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE-RESET_PROMISE_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - for (let j = 1; j < 51; j++) { - console.info('case configure-reset current loop: ' + j); - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - } - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START-STOP_PROMISE_0100 - * @tc.name : 001. start -> stop for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_START-STOP_PROMISE_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - await toGetInputSurface(); - await videoEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - for (let j = 1; j < 51; j++) { - console.info('case start-stop current loop: ' + j); - await videoEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - } - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CREATE-RELEASE_PROMISE_0100 - * @tc.name : 001. create -> release for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CREATE-RELEASE_PROMISE_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - for (let j = 1; j < 51; j++) { - console.info('case create-release current loop: ' + j); - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - done(); - }) - - /* * - * @tc.number : SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_TOTALLOOP_PROMISE_0100 - * @tc.name : 001. total loop for 50 times - * @tc.desc : Reliability Test - * @tc.size : MediumTest - * @tc.type : Reliability - * @tc.level : Level2 - */ - it('SUB_MEDIA_VIDEO_SOFTWARE_ENCODER_API_TOTALLOOP_PROMISE_0100', 0, async function (done) { - let name = 'avenc_mpeg4'; - for (let j = 1; j < 51; j++) { - console.info('case create-release current loop: ' + j); - await media.createVideoEncoderByName(name).then((processor) => { - if (typeof (processor) != 'undefined') { - videoEncodeProcessor = processor; - console.info('in case : createVideoEncoderByName success'); - } else { - console.info('in case : createVideoEncoderByName fail'); - expect().assertFail(); - done(); - } - }) - await videoEncodeProcessor.configure(mediaDescription).then(() => { - console.info("case configure success"); - }, failCallback).catch(failCatch); - await toGetInputSurface(); - await videoEncodeProcessor.prepare().then(() => { - console.info("case prepare success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.start().then(() => { - console.info("case start success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.flush().then(() => { - console.info("case flush success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.stop().then(() => { - console.info("case stop success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.reset().then(() => { - console.info("case reset success"); - }, failCallback).catch(failCatch); - await videoEncodeProcessor.release().then(() => { - console.info("case release success"); - }, failCallback).catch(failCatch); - videoEncodeProcessor = null; - } - done(); - }) -}) diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoHardwareEncoderEnumTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoHardwareEncoderEnumTest.test.js deleted file mode 100644 index 524bdcc377e90ce1aab5cf85f2ae3acc2596f410..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoHardwareEncoderEnumTest.test.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import media from '@ohos.multimedia.media' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('VideoHardwareEncoderEnum', function () { - - beforeAll(function() { - console.info('beforeAll case'); - }) - - beforeEach(function() { - console.info('beforeEach case'); - }) - - afterEach(function() { - console.info('afterEach case'); - }) - - afterAll(function() { - console.info('afterAll case'); - }) - - - /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_ENUM_MediaDescriptionKey_0100 - * @tc.name : 001.MediaDescriptionKey - * @tc.desc : Test Enumerate MediaDescriptionKey - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level0 - */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_ENUM_MediaDescriptionKey_0100', 0, async function (done) { - expect(media.MediaDescriptionKey.MD_KEY_SUSPEND_INPUT_SURFACE).assertEqual("suspend_input_surface"); - expect(media.MediaDescriptionKey.MD_KEY_VIDEO_ENCODE_BITRATE_MODE).assertEqual("video_encode_bitrate_mode"); - expect(media.MediaDescriptionKey.MD_KEY_PROFILE).assertEqual("codec_profile"); - expect(media.MediaDescriptionKey.MD_KEY_QUALITY).assertEqual("codec_quality"); - expect(media.MediaDescriptionKey.MD_KEY_CUSTOM).assertEqual("vendor.custom"); - expect(media.MediaDescriptionKey.MD_KEY_MAX_INPUT_SIZE).assertEqual("max_input_size"); - expect(media.MediaDescriptionKey.MD_KEY_MAX_ENCODER_FPS).assertEqual("max_encoder_fps"); - expect(media.MediaDescriptionKey.MD_KEY_WIDTH).assertEqual("width"); - expect(media.MediaDescriptionKey.MD_KEY_HEIGHT).assertEqual("height"); - expect(media.MediaDescriptionKey.MD_KEY_PIXEL_FORMAT).assertEqual("pixel_format"); - expect(media.MediaDescriptionKey.MD_KEY_FRAME_RATE).assertEqual("frame_rate"); - expect(media.MediaDescriptionKey.MD_KEY_CAPTURE_RATE).assertEqual("capture_rate"); - expect(media.MediaDescriptionKey.MD_KEY_I_FRAME_INTERVAL).assertEqual("i_frame_interval"); - expect(media.MediaDescriptionKey.MD_KEY_REQUEST_I_FRAME).assertEqual("req_i_frame"); - expect(media.MediaDescriptionKey.MD_KEY_REPEAT_FRAME_AFTER).assertEqual("repeat_frame_after"); - done(); - }) -}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/media/icon.png b/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/videoEncoder/src/main/resources/base/media/icon.png and /dev/null differ