Skip to content

Commit

Permalink
Ensure WebCodecs BB sample closes VideoFrames (webrtc#1492)
Browse files Browse the repository at this point in the history
* Ensure WebCodecs BB sample closes VideoFrames

Call frame.close() on received videoFrames after passing them to be
decoded. Without this, the video freezes due to too many VideoFrames
being kept around.
  • Loading branch information
tonyherre authored Nov 12, 2021
1 parent e0b12bd commit 8e504ed
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ class WebCodecTransform { // eslint-disable-line no-unused-vars
frame.close();
return;
}
this.controller_ = controller;
this.encoder_.encode(frame);
try {
this.controller_ = controller;
this.encoder_.encode(frame);
} finally {
frame.close();
}
}

/** @override */
Expand Down

0 comments on commit 8e504ed

Please sign in to comment.