提交 06f52d87 编写于 作者: L ling990

modify testcases Signed-off-by: ling990 <liling96@huawei.com>

Signed-off-by: Nling990 <ling990@qq.com>
上级 fc9bc412
......@@ -139,6 +139,7 @@ describe('AudioDecoderFuncCallback', function () {
let outputCnt = 0;
let inputCnt = 0;
let frameThreshold = 10;
let lockFlag = false;
beforeAll(async function() {
console.info('beforeAll case 1');
......@@ -254,6 +255,7 @@ describe('AudioDecoderFuncCallback', function () {
ES_LENGTH = 1500;
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
})
afterEach(async function() {
......@@ -288,6 +290,7 @@ describe('AudioDecoderFuncCallback', function () {
outputQueue = [];
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
}
async function getFdRead(readPath, done) {
......@@ -345,6 +348,7 @@ describe('AudioDecoderFuncCallback', function () {
}
async function flushWork(done) {
lockFlag = true;
inputQueue = [];
outputQueue = [];
await getFdRead(readpath, done);
......@@ -353,6 +357,11 @@ describe('AudioDecoderFuncCallback', function () {
console.info("case flush at inputeos success");
resetParam();
workdoneAtEOS =true;
lockFlag = false;
audioDecodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info("case start after flush success");
});
})
}
......@@ -403,10 +412,12 @@ describe('AudioDecoderFuncCallback', function () {
}
timestamp += ES[frameCnt]/samplerate;
frameCnt += 1;
audioDecodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
inputCnt += 1;
})
if (!lockFlag) {
audioDecodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
inputCnt += 1;
})
}
}
}
......@@ -431,9 +442,11 @@ describe('AudioDecoderFuncCallback', function () {
else{
console.info("write to file success");
}
audioDecodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
if (!lockFlag) {
audioDecodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
}
}
}
......@@ -677,12 +690,18 @@ describe('AudioDecoderFuncCallback', function () {
})
});
eventEmitter.on('flush', () => {
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush((err) => {
expect(err).assertUndefined();
console.info(`case flush after 2s success`);
})
lockFlag = false;
audioDecodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info(`case start after flush success`);
});
});
});
media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => {
expect(err).assertUndefined();
......
......@@ -138,6 +138,7 @@ describe('AudioDecoderFuncPromise', function () {
let outputCnt = 0;
let inputCnt = 0;
let frameThreshold = 10;
let lockFlag = false;
beforeAll(async function() {
......@@ -254,6 +255,7 @@ describe('AudioDecoderFuncPromise', function () {
ES_LENGTH = 1500;
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
})
afterEach(async function() {
......@@ -298,6 +300,7 @@ describe('AudioDecoderFuncPromise', function () {
outputQueue = [];
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
}
async function getFdRead(readPath, done) {
......@@ -349,6 +352,7 @@ describe('AudioDecoderFuncPromise', function () {
}
async function flushWork(done) {
lockFlag = true;
inputQueue = [];
outputQueue = [];
await getFdRead(readpath, done);
......@@ -357,6 +361,12 @@ describe('AudioDecoderFuncPromise', function () {
resetParam();
workdoneAtEOS =true;
}, failCallback).catch(failCatch);
lockFlag = false;
await audioDecodeProcessor.start().then(() => {
console.info("case start after flush success");
resetParam();
workdoneAtEOS =true;
}, failCallback).catch(failCatch);
}
async function doneWork() {
......@@ -399,10 +409,12 @@ describe('AudioDecoderFuncPromise', function () {
}
timestamp += ES[frameCnt]/samplerate;
frameCnt += 1;
audioDecodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
inputCnt += 1;
});
if (!lockFlag) {
audioDecodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
inputCnt += 1;
});
}
}
}
......@@ -430,9 +442,11 @@ describe('AudioDecoderFuncPromise', function () {
else{
console.info("write to file success");
}
audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
if (!lockFlag) {
audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
}
}
}
......@@ -605,12 +619,17 @@ describe('AudioDecoderFuncPromise', function () {
await audioDecodeProcessor.start().then(() => {
console.info("case start success");
}, failCallback).catch(failCatch);
await sleep(500).then(() => {
await sleep(500).then(async() => {
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush().then(() => {
await audioDecodeProcessor.flush().then(() => {
console.info("case flush after 5s");
}, failCallback).catch(failCatch);
lockFlag = false;
await audioDecodeProcessor.start().then(() => {
console.info("case start after flush success");
}, failCallback).catch(failCatch);
})
})
......
......@@ -147,6 +147,7 @@ describe('AudioDecoderReliabilityCallback', function () {
"audio_sample_format": 1,
};
let fdRead;
let lockFlag = false;
beforeAll(function() {
console.info('beforeAll case');
......@@ -257,6 +258,7 @@ describe('AudioDecoderReliabilityCallback', function () {
381, 410, 394, 386, 345, 345, 354, 397, 386, 375, 390, 347, 411, 381, 383, 374, 379,
380, 378, 391, 380, 339, 390, 383, 375];
ES_LENGTH = 500;
lockFlag = false;
})
afterEach(async function() {
......@@ -287,6 +289,7 @@ describe('AudioDecoderReliabilityCallback', function () {
sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
lockFlag = false;
}
async function createAudioDecoder(savepath, mySteps, done) {
......@@ -399,6 +402,7 @@ describe('AudioDecoderReliabilityCallback', function () {
case FLUSH:
mySteps.shift();
console.info(`case to flush`);
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush(async(err) => {
......@@ -410,6 +414,7 @@ describe('AudioDecoderReliabilityCallback', function () {
workdoneAtEOS = true;
flushAtEOS = false;
}
lockFlag = false;
nextStep(mySteps, mediaDescription, done);
});
break;
......@@ -518,9 +523,11 @@ describe('AudioDecoderReliabilityCallback', function () {
}
timestamp += ES[frameCnt]/samplerate;
frameCnt += 1;
audioDecodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
})
if (!lockFlag) {
audioDecodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
})
}
}
}
......@@ -538,9 +545,11 @@ describe('AudioDecoderReliabilityCallback', function () {
else{
console.info("not last frame, continue");
}
audioDecodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
if (!lockFlag) {
audioDecodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
}
}
}
......@@ -879,7 +888,7 @@ describe('AudioDecoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, END);
createAudioDecoder(savepath, mySteps, done);
})
......@@ -979,7 +988,7 @@ describe('AudioDecoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioDecoder(savepath, mySteps, done);
})
......@@ -994,7 +1003,7 @@ describe('AudioDecoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioDecoder(savepath, mySteps, done);
})
......@@ -1023,7 +1032,7 @@ describe('AudioDecoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, START, END);
EOSFrameNum = 2;
createAudioDecoder(savepath, mySteps, done);
})
......
......@@ -149,6 +149,7 @@ describe('AudioDecoderReliabilityPromise', function () {
};
let expectError = false;
let fdRead;
let lockFlag = false;
beforeAll(function() {
console.info('beforeAll case');
......@@ -261,6 +262,7 @@ describe('AudioDecoderReliabilityPromise', function () {
380, 378, 391, 380, 339, 390, 383, 375];
ES_LENGTH = 500;
expectError = false;
lockFlag = false;
})
afterEach(async function() {
......@@ -308,6 +310,7 @@ describe('AudioDecoderReliabilityPromise', function () {
sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
lockFlag = false;
}
async function createAudioDecoder(savepath, mySteps, done) {
......@@ -416,6 +419,7 @@ describe('AudioDecoderReliabilityPromise', function () {
case FLUSH:
mySteps.shift();
console.info(`case to flush`);
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush().then(async() => {
......@@ -426,6 +430,7 @@ describe('AudioDecoderReliabilityPromise', function () {
workdoneAtEOS = true;
flushAtEOS = false;
}
lockFlag = false;
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
break;
......@@ -525,9 +530,11 @@ describe('AudioDecoderReliabilityPromise', function () {
}
timestamp += ES[frameCnt]/samplerate;
frameCnt += 1;
audioDecodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
});
if (!lockFlag) {
audioDecodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
});
}
}
}
......@@ -546,9 +553,11 @@ describe('AudioDecoderReliabilityPromise', function () {
else{
console.info("not last frame, continue");
}
audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
if (!lockFlag) {
audioDecodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
}
}
}
......@@ -885,7 +894,7 @@ describe('AudioDecoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, END);
createAudioDecoder(savepath, mySteps, done);
})
......@@ -985,7 +994,7 @@ describe('AudioDecoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioDecoder(savepath, mySteps, done);
})
......@@ -1000,7 +1009,7 @@ describe('AudioDecoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioDecoder(savepath, mySteps, done);
})
......@@ -1029,7 +1038,7 @@ describe('AudioDecoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, START, END);
EOSFrameNum = 2;
createAudioDecoder(savepath, mySteps, done);
})
......
......@@ -47,6 +47,7 @@ describe('AudioEncoderFuncCallback', function () {
let outputCnt = 0;
let inputCnt = 0;
let frameThreshold = 10;
let lockFlag = false;
beforeAll(async function() {
console.info('beforeAll case 1');
......@@ -72,6 +73,7 @@ describe('AudioEncoderFuncCallback', function () {
ES_LENGTH = 1500;
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
})
afterEach(async function() {
......@@ -105,6 +107,7 @@ describe('AudioEncoderFuncCallback', function () {
outputQueue = [];
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
}
async function getFdRead(readPath, done) {
......@@ -162,6 +165,7 @@ describe('AudioEncoderFuncCallback', function () {
}
async function flushWork(done) {
lockFlag = true;
inputQueue = [];
outputQueue = [];
await getFdRead(readpath, done);
......@@ -170,6 +174,11 @@ describe('AudioEncoderFuncCallback', function () {
console.info("case flush at inputeos success");
resetParam();
workdoneAtEOS =true;
lockFlag = false;
audioEncodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info("case start after flush success");
})
})
}
......@@ -218,10 +227,12 @@ describe('AudioEncoderFuncCallback', function () {
}
timestamp += 23;
frameCnt += 1;
audioEncodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
inputCnt += 1;
})
if (!lockFlag) {
audioEncodeProcessor.pushInputData(inputobject, () => {
console.info('queueInput success');
inputCnt += 1;
})
}
}
}
......@@ -246,9 +257,11 @@ describe('AudioEncoderFuncCallback', function () {
else{
console.info("write to file success");
}
audioEncodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
if (!lockFlag) {
audioEncodeProcessor.freeOutputBuffer(outputobject, () => {
console.info('release output success');
})
}
}
}
......@@ -481,11 +494,17 @@ describe('AudioEncoderFuncCallback', function () {
})
});
eventEmitter.on('flush', () => {
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush((err) => {
expect(err).assertUndefined();
console.info(`case flush after 2s success`);
lockFlag = false;
audioEncodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info(`case start after flush success`);
})
})
});
media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => {
......
......@@ -47,6 +47,7 @@ describe('AudioEncoderFuncPromise', function () {
let outputCnt = 0;
let inputCnt = 0;
let frameThreshold = 10;
let lockFlag = false;
beforeAll(async function() {
......@@ -73,6 +74,7 @@ describe('AudioEncoderFuncPromise', function () {
ES_LENGTH = 1500;
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
})
afterEach(async function() {
......@@ -116,6 +118,7 @@ describe('AudioEncoderFuncPromise', function () {
outputQueue = [];
outputCnt = 0;
inputCnt = 0;
lockFlag = false;
}
async function getFdRead(readPath, done) {
......@@ -160,6 +163,7 @@ describe('AudioEncoderFuncPromise', function () {
}
async function flushWork(done) {
lockFlag = true;
inputQueue = [];
outputQueue = [];
await getFdRead(readpath, done);
......@@ -167,6 +171,10 @@ describe('AudioEncoderFuncPromise', function () {
console.info("case flush at inputeos success");
resetParam();
workdoneAtEOS =true;
lockFlag = false;
}, failCallback).catch(failCatch);
await audioEncodeProcessor.start().then(() => {
console.info("case start after flush success");
}, failCallback).catch(failCatch);
}
......@@ -212,10 +220,12 @@ describe('AudioEncoderFuncPromise', function () {
}
timestamp += 23;
frameCnt += 1;
audioEncodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
inputCnt += 1;
});
if (!lockFlag) {
await audioEncodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
inputCnt += 1;
});
}
}
}
......@@ -242,9 +252,11 @@ describe('AudioEncoderFuncPromise', function () {
else{
console.info("write to file success");
}
audioEncodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
if (!lockFlag) {
await audioEncodeProcessor.freeOutputBuffer(outputobject).then(() => {
console.info('release output success');
});
}
}
}
......@@ -423,11 +435,16 @@ describe('AudioEncoderFuncPromise', function () {
await audioEncodeProcessor.start().then(() => {
console.info("case start success")
}, failCallback).catch(failCatch);
await sleep(500).then(() => {
await sleep(500).then(async() => {
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush().then(() => {
console.info("case flush after 5s")
await audioEncodeProcessor.flush().then(() => {
console.info("case flush after 5s");
lockFlag = false;
}, failCallback).catch(failCatch);
await audioEncodeProcessor.start().then(() => {
console.info("case start after flush success");
}, failCallback).catch(failCatch);
});
})
......
......@@ -59,6 +59,7 @@ describe('AudioEncoderReliabilityCallback', function () {
"audio_sample_format": 1,
};
let fdRead;
let lockFlag = false;
beforeAll(function() {
console.info('beforeAll case');
......@@ -80,6 +81,7 @@ describe('AudioEncoderReliabilityCallback', function () {
inputQueue = [];
outputQueue = [];
ES_LENGTH = 200;
lockFlag = false;
})
afterEach(async function() {
......@@ -110,6 +112,7 @@ describe('AudioEncoderReliabilityCallback', function () {
sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
lockFlag = false;
}
async function createAudioEncoder(savepath, mySteps, done) {
......@@ -220,6 +223,7 @@ describe('AudioEncoderReliabilityCallback', function () {
case FLUSH:
mySteps.shift();
console.info(`case to flush`);
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush(async(err) => {
......@@ -231,6 +235,7 @@ describe('AudioEncoderReliabilityCallback', function () {
workdoneAtEOS = true;
flushAtEOS = false;
}
lockFlag = false;
nextStep(mySteps, mediaDescription, done);
});
break;
......@@ -699,7 +704,7 @@ describe('AudioEncoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, END);
createAudioEncoder(savepath, mySteps, done);
})
......@@ -799,7 +804,7 @@ describe('AudioEncoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioEncoder(savepath, mySteps, done);
})
......@@ -814,7 +819,7 @@ describe('AudioEncoderReliabilityCallback', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioEncoder(savepath, mySteps, done);
})
......
......@@ -60,6 +60,7 @@ describe('AudioEncoderReliabilityPromise', function () {
};
let expectError = false;
let fdRead;
let lockFlag = false;
beforeAll(function() {
console.info('beforeAll case');
......@@ -82,6 +83,7 @@ describe('AudioEncoderReliabilityPromise', function () {
outputQueue = [];
ES_LENGTH = 200;
expectError = false;
lockFlag = false;
})
afterEach(async function() {
......@@ -128,6 +130,7 @@ describe('AudioEncoderReliabilityPromise', function () {
sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
lockFlag = false;
}
async function createAudioEncoder(savepath, mySteps, done) {
......@@ -189,7 +192,7 @@ describe('AudioEncoderReliabilityPromise', function () {
async function nextStep(mySteps, done) {
console.info("case myStep[0]: " + mySteps[0]);
if (mySteps[0] == END) {
audioEncodeProcessor.release().then(() => {
await audioEncodeProcessor.release().then(() => {
console.info("case release success");
audioEncodeProcessor = null;
done();
......@@ -199,7 +202,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case CONFIGURE:
mySteps.shift();
console.info(`case to configure`);
audioEncodeProcessor.configure(mediaDescription).then(() => {
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info(`case configure 1`);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
......@@ -207,7 +210,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case PREPARE:
mySteps.shift();
console.info(`case to prepare`);
audioEncodeProcessor.prepare().then(() => {
await audioEncodeProcessor.prepare().then(() => {
console.info(`case prepare 1`);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
......@@ -221,7 +224,7 @@ describe('AudioEncoderReliabilityPromise', function () {
workdoneAtEOS = true;
enqueueInputs(inputQueue);
}
audioEncodeProcessor.start().then(() => {
await audioEncodeProcessor.start().then(() => {
console.info(`case start 1`);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
......@@ -229,9 +232,10 @@ describe('AudioEncoderReliabilityPromise', function () {
case FLUSH:
mySteps.shift();
console.info(`case to flush`);
lockFlag = true;
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush().then(async() => {
await audioEncodeProcessor.flush().then(async() => {
console.info(`case flush 1`);
if (flushAtEOS) {
await getFdRead(AUDIOPATH, done);
......@@ -239,13 +243,14 @@ describe('AudioEncoderReliabilityPromise', function () {
workdoneAtEOS = true;
flushAtEOS = false;
}
lockFlag = false;
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
break;
case STOP:
mySteps.shift();
console.info(`case to stop`);
audioEncodeProcessor.stop().then(() => {
await audioEncodeProcessor.stop().then(() => {
console.info(`case stop 1`);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
......@@ -254,7 +259,7 @@ describe('AudioEncoderReliabilityPromise', function () {
mySteps.shift();
console.info(`case to reset`);
resetParam();
audioEncodeProcessor.reset().then(() => {
await audioEncodeProcessor.reset().then(() => {
console.info(`case reset 1`);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
......@@ -272,7 +277,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case CONFIGURE_ERROR:
mySteps.shift();
console.info(`case to configure 2`);
audioEncodeProcessor.configure(mediaDescription).then(() => {
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info(`case configure error 1`);
expect(expectError).assertTrue();
}, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch);
......@@ -280,7 +285,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case PREPARE_ERROR:
mySteps.shift();
console.info(`case to prepare 2`);
audioEncodeProcessor.prepare().then(() => {
await audioEncodeProcessor.prepare().then(() => {
console.info(`case prepare error 1`);
expect(expectError).assertTrue();
}, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch);
......@@ -288,7 +293,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case START_ERROR:
mySteps.shift();
console.info(`case to start 2`);
audioEncodeProcessor.start().then(() => {
await audioEncodeProcessor.start().then(() => {
console.info(`case start error 1`);
expect(expectError).assertTrue();
}, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch);
......@@ -296,7 +301,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case FLUSH_ERROR:
mySteps.shift();
console.info(`case to flush 2`);
audioEncodeProcessor.flush().then(() => {
await audioEncodeProcessor.flush().then(() => {
console.info(`case flush error 1`);
expect(expectError).assertTrue();
}, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch);
......@@ -304,7 +309,7 @@ describe('AudioEncoderReliabilityPromise', function () {
case STOP_ERROR:
mySteps.shift();
console.info(`case to stop 2`);
audioEncodeProcessor.stop().then(() => {
await audioEncodeProcessor.stop().then(() => {
console.info(`case stop error 1`);
expect(expectError).assertTrue();
}, (err) => {failCallbackTrue(err, mySteps, done)}).catch(failCatch);
......@@ -701,7 +706,7 @@ describe('AudioEncoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, END);
createAudioEncoder(savepath, mySteps, done);
})
......@@ -801,7 +806,7 @@ describe('AudioEncoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioEncoder(savepath, mySteps, done);
})
......@@ -816,7 +821,7 @@ describe('AudioEncoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, FLUSH, START, FLUSH, START, WAITFORALLOUTS);
workdoneAtEOS = true;
createAudioEncoder(savepath, mySteps, done);
})
......@@ -845,7 +850,7 @@ describe('AudioEncoderReliabilityPromise', function () {
*/
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);
let mySteps = new Array(CONFIGURE, PREPARE, START, HOLDON, FLUSH, START, END);
EOSFrameNum = 2;
createAudioEncoder(savepath, mySteps, done);
})
......
......@@ -19,6 +19,4 @@ 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')
\ No newline at end of file
......@@ -75,6 +75,7 @@ describe('VideoDecoderReliCallbackTest', function () {
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;
let fdRead;
let lockFlag = false;
beforeAll(function() {
console.info('beforeAll case');
......@@ -97,6 +98,7 @@ describe('VideoDecoderReliCallbackTest', function () {
inputEosFlag = false;
position = 0;
surfaceID = globalThis.value;
lockFlag = false;
})
afterEach(async function() {
......@@ -245,6 +247,7 @@ describe('VideoDecoderReliCallbackTest', function () {
});
}
function toFlush(mySteps, done, expectFail) {
lockFlag = true;
videoDecodeProcessor.flush((err) => {
console.info(`case flush callback`);
printError(err, expectFail);
......@@ -255,6 +258,7 @@ describe('VideoDecoderReliCallbackTest', function () {
timestamp = 0;
frameCountIn = 1;
}
lockFlag = false;
toNextStep(mySteps, done);
});
}
......@@ -474,7 +478,7 @@ describe('VideoDecoderReliCallbackTest', function () {
*/
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);
DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.WAIT_FOR_ALL_OUTS);
workdoneAtEOS = true;
toCreateVideoDecoderByMime('video/avc', mySteps, done);
})
......@@ -825,7 +829,7 @@ describe('VideoDecoderReliCallbackTest', function () {
*/
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);
DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.RELEASE);
toCreateVideoDecoderByMime('video/avc', mySteps, done);
})
......@@ -937,7 +941,7 @@ describe('VideoDecoderReliCallbackTest', function () {
*/
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);
DECODE_STEP.FLUSH, DECODE_STEP.START, DECODE_STEP.FLUSH, DECODE_STEP.RELEASE);
toCreateVideoDecoderByMime('video/avc', mySteps, done);
})
......
......@@ -17,7 +17,6 @@
{
"type": "ShellKit",
"run-command": [
"setenforce 0",
"rm -rf /storage/media/100/local/files/*",
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoencoder/haps/entry/files/",
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.video.videoencoder/haps/entry/files/"
......@@ -41,7 +40,6 @@
"chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.video.videoencoder/haps/entry/files/*"
],
"teardown-command":[
"setenforce 1"
]
}
]
......
......@@ -681,6 +681,7 @@ describe('videoHardwareEncoderFuncPromise', function () {
needRelease = true;
await toStartEnc();
await toFlushDec();
await toStartDec();
});
})
......@@ -705,10 +706,12 @@ describe('videoHardwareEncoderFuncPromise', function () {
await sleep(5000);
expect(outputEncEos).assertFalse();
await toFlushEnc();
await toStartEnc();
resetReadParam();
resetStateParam();
needRelease = true;
await toFlushDec();
await toStartDec();
})
/* *
......@@ -731,10 +734,12 @@ describe('videoHardwareEncoderFuncPromise', function () {
await startDecProcess(mime, srcPath, mediaDescription2, done);
eventEmitter.on('flushAtEos', async() => {
await toFlushEnc();
await toStartEnc();
resetReadParam();
resetStateParam();
needRelease = true;
await toFlushDec();
await toStartDec();
});
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册