Skip to content

Commit

Permalink
tweak consume_stats api
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-armstrong committed Mar 22, 2016
1 parent 28d393e commit 9aeb803
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion quiet-emscripten.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions quiet.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,11 @@ var Quiet = (function() {
lastChecksumFailCount = currentChecksumFailCount;

if (opts.onReceiverStatsUpdate !== undefined) {
var stats = Module.ccall('quiet_decoder_consume_stats', 'number', ['pointer'], [decoder]);
var num_frames_ptr = Module.ccall('malloc', 'pointer', ['number'], [4]);
var frames = Module.ccall('quiet_decoder_consume_stats', 'pointer', ['pointer', 'pointer'], [decoder, num_frames_ptr]);
// time for some more pointer arithmetic
var num_frames = Module.HEAPU32[stats/4];
var frames = Module.HEAPU32[(stats/4) + 1];
var num_frames = Module.HEAPU32[num_frames_ptr/4];
Module.ccall('free', null, ['pointer'], [num_frames_ptr]);

var framesize = 4 + 4 + 4 + 4 + 4;
var stats = [];
Expand Down

0 comments on commit 9aeb803

Please sign in to comment.