提交 143bd1d9 编写于 作者: L ling990

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

Signed-off-by: Nling990 <liling96@huawei.com>
上级 9e4101ba
...@@ -324,6 +324,8 @@ describe('AudioDecoderFunc', function () { ...@@ -324,6 +324,8 @@ describe('AudioDecoderFunc', function () {
} }
async function flushWork() { async function flushWork() {
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush((err) => { audioDecodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
...@@ -640,6 +642,8 @@ describe('AudioDecoderFunc', function () { ...@@ -640,6 +642,8 @@ describe('AudioDecoderFunc', function () {
}) })
}); });
eventEmitter.on('flush', () => { eventEmitter.on('flush', () => {
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush((err) => { audioDecodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info(`case flush after 2s`); console.info(`case flush after 2s`);
......
...@@ -326,6 +326,8 @@ describe('AudioDecoderFunc', function () { ...@@ -326,6 +326,8 @@ describe('AudioDecoderFunc', function () {
} }
async function flushWork() { async function flushWork() {
inputQueue = [];
outputQueue = [];
await audioDecodeProcessor.flush().then(() => { await audioDecodeProcessor.flush().then(() => {
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
resetParam(); resetParam();
...@@ -568,6 +570,8 @@ describe('AudioDecoderFunc', function () { ...@@ -568,6 +570,8 @@ describe('AudioDecoderFunc', function () {
console.info("case start success"); console.info("case start success");
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
await sleep(3000).then(() => { await sleep(3000).then(() => {
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush().then(() => { audioDecodeProcessor.flush().then(() => {
console.info("case flush after 5s"); console.info("case flush after 5s");
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
......
...@@ -123,6 +123,8 @@ describe('AudioDecoderMultiInstances', function () { ...@@ -123,6 +123,8 @@ describe('AudioDecoderMultiInstances', function () {
} }
async function flushWork(audioDecodeProcessor) { async function flushWork(audioDecodeProcessor) {
inputQueue = [];
outputQueue = [];
await audioDecodeProcessor.flush().then(() => { await audioDecodeProcessor.flush().then(() => {
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
resetParam(); resetParam();
......
...@@ -283,6 +283,8 @@ describe('AudioDecoderReliabilityCallback', function () { ...@@ -283,6 +283,8 @@ describe('AudioDecoderReliabilityCallback', function () {
timestamp = 0; timestamp = 0;
sawInputEOS = false; sawInputEOS = false;
sawOutputEOS = false; sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
} }
function createAudioDecoder(savepath, mySteps, done) { function createAudioDecoder(savepath, mySteps, done) {
...@@ -398,6 +400,8 @@ describe('AudioDecoderReliabilityCallback', function () { ...@@ -398,6 +400,8 @@ describe('AudioDecoderReliabilityCallback', function () {
case FLUSH: case FLUSH:
mySteps.shift(); mySteps.shift();
console.info(`case to flush`); console.info(`case to flush`);
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush((err) => { audioDecodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info(`case flush 1`); console.info(`case flush 1`);
......
...@@ -303,6 +303,8 @@ describe('AudioDecoderReliabilityPromise', function () { ...@@ -303,6 +303,8 @@ describe('AudioDecoderReliabilityPromise', function () {
timestamp = 0; timestamp = 0;
sawInputEOS = false; sawInputEOS = false;
sawOutputEOS = false; sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
} }
function createAudioDecoder(savepath, mySteps, done) { function createAudioDecoder(savepath, mySteps, done) {
...@@ -409,6 +411,8 @@ describe('AudioDecoderReliabilityPromise', function () { ...@@ -409,6 +411,8 @@ describe('AudioDecoderReliabilityPromise', function () {
case FLUSH: case FLUSH:
mySteps.shift(); mySteps.shift();
console.info(`case to flush`); console.info(`case to flush`);
inputQueue = [];
outputQueue = [];
audioDecodeProcessor.flush().then(() => { audioDecodeProcessor.flush().then(() => {
console.info(`case flush 1`); console.info(`case flush 1`);
if (flushAtEOS) { if (flushAtEOS) {
......
...@@ -166,6 +166,8 @@ describe('AudioEncoderFuncCallback', function () { ...@@ -166,6 +166,8 @@ describe('AudioEncoderFuncCallback', function () {
} }
async function flushWork() { async function flushWork() {
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush((err) => { audioEncodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
...@@ -290,7 +292,6 @@ describe('AudioEncoderFuncCallback', function () { ...@@ -290,7 +292,6 @@ describe('AudioEncoderFuncCallback', function () {
*/ */
it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) { it('SUB_MEDIA_AUDIO_ENCODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) {
console.info("test set EOS after last frame and reset"); console.info("test set EOS after last frame and reset");
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
let mediaDescription = { let mediaDescription = {
...@@ -356,7 +357,7 @@ describe('AudioEncoderFuncCallback', function () { ...@@ -356,7 +357,7 @@ describe('AudioEncoderFuncCallback', function () {
} }
}) })
}) })
media.createAudioEncoderByName('avdec_aac', (err, processor) => { media.createAudioEncoderByName('avenc_aac', (err, processor) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info(`case createAudioEncoder by mime 1`); console.info(`case createAudioEncoder by mime 1`);
audioEncodeProcessor = processor; audioEncodeProcessor = processor;
...@@ -473,6 +474,8 @@ describe('AudioEncoderFuncCallback', function () { ...@@ -473,6 +474,8 @@ describe('AudioEncoderFuncCallback', function () {
}) })
}); });
eventEmitter.on('flush', () => { eventEmitter.on('flush', () => {
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush((err) => { audioEncodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info(`case flush after 5s`); console.info(`case flush after 5s`);
......
...@@ -174,6 +174,8 @@ describe('AudioEncoderFuncPromise', function () { ...@@ -174,6 +174,8 @@ describe('AudioEncoderFuncPromise', function () {
} }
async function flushWork() { async function flushWork() {
inputQueue = [];
outputQueue = [];
await audioEncodeProcessor.flush().then(() => { await audioEncodeProcessor.flush().then(() => {
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
resetParam(); resetParam();
...@@ -427,6 +429,8 @@ describe('AudioEncoderFuncPromise', function () { ...@@ -427,6 +429,8 @@ describe('AudioEncoderFuncPromise', function () {
console.info("case start success") console.info("case start success")
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
await sleep(5000).then(() => { await sleep(5000).then(() => {
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush().then(() => { audioEncodeProcessor.flush().then(() => {
console.info("case flush after 5s") console.info("case flush after 5s")
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
...@@ -627,7 +631,7 @@ describe('AudioEncoderFuncPromise', function () { ...@@ -627,7 +631,7 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
let savepath2 = BASIC_PATH + '0601.txt'; let savepath2 = BASIC_PATH + '0601.txt';
workdoneAtEOS = true; workdoneAtEOS = true;
setCallback(audioEncodeProcessor, savepath2, done); setCallback(savepath2, done);
await audioEncodeProcessor.prepare().then(() => { await audioEncodeProcessor.prepare().then(() => {
console.info("prepare2 success"); console.info("prepare2 success");
}, failCallback).catch(failCatch); }, failCallback).catch(failCatch);
......
...@@ -166,6 +166,8 @@ describe('AudioEncoderFuncPromise', function () { ...@@ -166,6 +166,8 @@ describe('AudioEncoderFuncPromise', function () {
} }
async function flushWork(audioEncodeProcessor) { async function flushWork(audioEncodeProcessor) {
inputQueue = [];
outputQueue = [];
await audioEncodeProcessor.flush().then(() => { await audioEncodeProcessor.flush().then(() => {
console.info("case flush at inputeos success"); console.info("case flush at inputeos success");
resetParam(); resetParam();
......
...@@ -106,6 +106,8 @@ describe('AudioEncoderSTTCallback', function () { ...@@ -106,6 +106,8 @@ describe('AudioEncoderSTTCallback', function () {
timestamp = 0; timestamp = 0;
sawInputEOS = false; sawInputEOS = false;
sawOutputEOS = false; sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
} }
function createAudioEncoder(savepath, mySteps, done) { function createAudioEncoder(savepath, mySteps, done) {
...@@ -247,6 +249,8 @@ describe('AudioEncoderSTTCallback', function () { ...@@ -247,6 +249,8 @@ describe('AudioEncoderSTTCallback', function () {
case FLUSH: case FLUSH:
mySteps.shift(); mySteps.shift();
console.info(`case to flush`); console.info(`case to flush`);
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush((err) => { audioEncodeProcessor.flush((err) => {
expect(err).assertUndefined(); expect(err).assertUndefined();
console.info(`case flush 1`); console.info(`case flush 1`);
......
...@@ -123,6 +123,8 @@ describe('AudioEncoderSTTPromise', function () { ...@@ -123,6 +123,8 @@ describe('AudioEncoderSTTPromise', function () {
timestamp = 0; timestamp = 0;
sawInputEOS = false; sawInputEOS = false;
sawOutputEOS = false; sawOutputEOS = false;
inputQueue = [];
outputQueue = [];
} }
function createAudioEncoder(savepath, mySteps, done) { function createAudioEncoder(savepath, mySteps, done) {
...@@ -257,6 +259,8 @@ describe('AudioEncoderSTTPromise', function () { ...@@ -257,6 +259,8 @@ describe('AudioEncoderSTTPromise', function () {
case FLUSH: case FLUSH:
mySteps.shift(); mySteps.shift();
console.info(`case to flush`); console.info(`case to flush`);
inputQueue = [];
outputQueue = [];
audioEncodeProcessor.flush().then(() => { audioEncodeProcessor.flush().then(() => {
console.info(`case flush 1`); console.info(`case flush 1`);
if (flushAtEOS) { if (flushAtEOS) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册