Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
/vpx-yuv now contains only the latest set of decoded frames
Browse files Browse the repository at this point in the history
  • Loading branch information
ankh-g committed Dec 1, 2018
1 parent 166bed3 commit 315c5f3
Show file tree
Hide file tree
Showing 7 changed files with 1,687 additions and 1,796 deletions.
3 changes: 0 additions & 3 deletions src/web_app/js/appcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,8 @@ AppController.prototype.transitionToActive_ = function () {

const sendFrame = () => {
const time = Date.now();

console.log('taking a rgba video frame');
localContext2d.drawImage(this.miniVideo_, 0, 0, width, height);
const {data: rgba} = localContext2d.getImageData(0, 0, width, height);

const packets = this.libvpx_.encode(rgba);
console.log('Total time to process this frame:', Date.now() - time, 'ms');
console.warn('Sending IVF data to remote:', packets.length, 'bytes');
Expand Down
16 changes: 1 addition & 15 deletions src/web_app/js/libvpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class LibVPX {

this._initialized = false;
this._lastIvfSize = 0;
this._lastYuvSize = 0;

this._loadWasm('/wasm/libvpx/libvpx.js');
}
Expand Down Expand Up @@ -103,7 +102,6 @@ class LibVPX {
const ivfSize = FS.stat(IVF_FILE).size;
FS.write(ivfFile, ivfData, 0, ivfData.length, ivfSize);
FS.close(ivfFile);
console.log('Added new IVF data at file pos', ivfSize);

if (!this._initialized) {
console.warn('initializing vpx decoder');
Expand All @@ -119,19 +117,7 @@ class LibVPX {

// Read the new YUV frames written by the decoder.

const newYuvSize = FS.stat(YUV_FILE).size;

if (newYuvSize == this._lastYuvSize) {
console.warn('No new YUV frames decoded.');
return [];
}

const yuvFile = FS.open(YUV_FILE, 'r');
const yuvFrames = new Uint8Array(newYuvSize - this._lastYuvSize);
FS.read(yuvFile, yuvFrames, 0, yuvFrames.length, this._lastYuvSize);
FS.close(yuvFile);
this._lastYuvSize = newYuvSize;

const yuvFrames = FS.readFile(YUV_FILE);
if (yuvFrames.length % yuvSize != 0)
console.warn('Wrong YUV size:', yuvFrames.length, '%', yuvSize, '!= 0');

Expand Down
Binary file modified src/web_app/wasm/libvpx/libvpx.a
Binary file not shown.
4 changes: 2 additions & 2 deletions src/web_app/wasm/libvpx/libvpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ var ASM_CONSTS = [];

STATIC_BASE = GLOBAL_BASE;

STATICTOP = STATIC_BASE + 131616;
STATICTOP = STATIC_BASE + 131600;
/* global initializers */ __ATINIT__.push();


Expand All @@ -1843,7 +1843,7 @@ STATICTOP = STATIC_BASE + 131616;



var STATIC_BUMP = 131616;
var STATIC_BUMP = 131600;
Module["STATIC_BASE"] = STATIC_BASE;
Module["STATIC_BUMP"] = STATIC_BUMP;

Expand Down
Binary file modified src/web_app/wasm/libvpx/libvpx.wasm
Binary file not shown.
3,460 changes: 1,684 additions & 1,776 deletions src/web_app/wasm/libvpx/libvpx.wast

Large diffs are not rendered by default.

Binary file modified src/web_app/wasm/libvpx/libvpx_g.a
Binary file not shown.

0 comments on commit 315c5f3

Please sign in to comment.