Skip to content

Commit

Permalink
真的很讨人厌诶~
Browse files Browse the repository at this point in the history
  • Loading branch information
numberwolf committed Dec 3, 2021
1 parent 2ce0833 commit 6ba5a0d
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 21 deletions.
4 changes: 4 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| 更新日志 | 内容 |
| ---- | ---- |
| 时间 | 2021/12/04 - 凌晨 |
| - | 0.修复 http-flv 265 渲染上下文Crash问题 |
| - | 1.修复 hls播放全屏错误 |
| - | 2.修复 一些播放问题 |
| 时间 | 2021/11/29 - 夜 |
| - | 0.修复 http-flv起播重试问题、修复一些bug |
| 时间 | 2021/11/25 - 夜 |
Expand Down
6 changes: 5 additions & 1 deletion README_EN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,11 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| Update | Content |
| ---- | ---- |
| Time | 2021/11/29 -|
| Time | 2021/12/04 - In the small hours |
| - | 0.Fixed http-flv 265 Render With crash |
| - | 1.Fixed hls problem of fullscreen |
| - | 2.Fixed some bugs |
| Time | 2021/11/29 - Night |
| - | 0.Fixed http-flv retry case and some bugs |
| Time | 2021/11/25 - Night |
| - | 0.Fixed httpflv/ws LIVE ignoreAudio problem |
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20211129');
require('./h265webjs-v20211204');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
6 changes: 3 additions & 3 deletions example/dist/dist-play.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20211129');
require('./h265webjs-v20211204');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example_normal/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20211129');
require('./h265webjs-v20211204');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
2 changes: 1 addition & 1 deletion example_normal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<link rel="stylesheet" type="text/css" href='player-view/css/progress.css'>
<script src="dist/missile.js"></script> <!-- IMPORTANT -->
<!--<script src="dist/missile-256mb-v20211104.js"></script>--> <!-- wasm for 265mb memory(with grow) -->
<script src="dist/h265webjs-v20211129.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20211204.js"></script> <!-- IMPORTANT -->
<script src="example.js"></script> <!-- IMPORTANT -->
<style>
</style>
Expand Down
5 changes: 5 additions & 0 deletions src/src/decoder/c-httplive-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,11 @@ class CHttpLiveCoreModule { // export default
this.audioWAudio && this.audioWAudio.stop();
this.audioWAudio = null;

if (this.AVGLObj !== undefined && this.AVGLObj !== null) {
RenderEngine420P.releaseContext(this.AVGLObj);
this.AVGLObj = null;
}

this.CanvasObj && this.CanvasObj.remove();
this.CanvasObj = null;

Expand Down
31 changes: 24 additions & 7 deletions src/src/decoder/c-native-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class CNativeCoreModule {
this.onRender = null;
this.onCacheProcess = null;
this.onReadyShowDone = null;
this.onRelease = null;

/*
* Init Module
Expand Down Expand Up @@ -264,11 +265,6 @@ class CNativeCoreModule {
}

release() {
if (this.canvas !== undefined && this.canvas !== null) {
this.canvas.remove();
this.canvas = null;
}

if (this.playFrameInterval !== null) {
window.clearInterval(this.playFrameInterval);
this.playFrameInterval = null;
Expand All @@ -290,8 +286,12 @@ class CNativeCoreModule {
}
this._clearDecInterval();
this._removeBindFuncPtr(); // @TODO
let releaseRet = Module.cwrap(
'releaseSniffStream', 'number', ['number'])(this.corePtr);
let releaseRet = -1;
if (this.corePtr !== undefined && this.corePtr !== null) {
releaseRet = Module.cwrap(
'releaseSniffStream', 'number', ['number'])(this.corePtr);
this.corePtr = null;
}
this.audioWAudio && this.audioWAudio.stop();
this.audioWAudio = null;

Expand All @@ -301,6 +301,20 @@ class CNativeCoreModule {

this.playVPipe.length = 0;
// this.playAPipe.length = 0;

if (this.yuv !== undefined && this.yuv !== null) {
RenderEngine420P.releaseContext(this.yuv);
this.yuv = null;
}

if (this.canvas !== undefined && this.canvas !== null) {
this.canvas.remove();
this.canvas = null;
}

this.config.readyShow = true;

this.onRelease && this.onRelease();
return releaseRet;
}

Expand Down Expand Up @@ -1511,6 +1525,9 @@ class CNativeCoreModule {
* @return
*/
pushBuffer(buffer) {
if (this.corePtr === undefined || this.corePtr === null) {
return -1;
}
let offset = Module._malloc(buffer.length);
Module.HEAP8.set(buffer, offset);
let pushRet = Module.cwrap('pushSniffStreamData', 'number',
Expand Down
5 changes: 5 additions & 0 deletions src/src/decoder/c-wslive-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ class CWsLiveCoreModule { // export default
this.audioWAudio && this.audioWAudio.stop();
this.audioWAudio = null;

if (this.AVGLObj !== undefined && this.AVGLObj !== null) {
RenderEngine420P.releaseContext(this.AVGLObj);
this.AVGLObj = null;
}

this.CanvasObj && this.CanvasObj.remove();
this.CanvasObj = null;

Expand Down
9 changes: 9 additions & 0 deletions src/src/decoder/player-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = config => {
},
vcodecerPtr: null,
videoCallback: null,
vCodecID: def.V_CODEC_NAME_HEVC,
/*
* frame.data
* frame.pts
Expand Down Expand Up @@ -647,6 +648,11 @@ module.exports = config => {
player.stream = new Uint8Array();
};
player.release = () => { // 释放
if (player.yuv !== undefined && player.yuv !== null) {
RenderEngine420P.releaseContext(player.yuv);
player.yuv = null;
}

player.endAudio();
player.cacheLoop && window.clearInterval(player.cacheLoop);
player.cacheLoop = null;
Expand All @@ -666,6 +672,9 @@ module.exports = config => {
player.durationMs = -1.0;
player.videoPTS = 0;
player.isPlaying = false;

player.canvas.remove();
player.canvas = null;
return true;
};
player.nextNalu = (onceGetNalCount=1) => {
Expand Down
7 changes: 7 additions & 0 deletions src/src/h265webjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class H265webjsModule {
} else {
this.player.release(); // keep
}
this.configFormat.extInfo.readyShow = true;
return true;
}

Expand Down Expand Up @@ -1269,6 +1270,7 @@ class H265webjsModule {
// };
let controller = new AbortController();
let signal = controller.signal;
// let isReportNetworkErr = true;

let playerConfig = {
width: this.configFormat.playerW,
Expand All @@ -1287,6 +1289,11 @@ class H265webjsModule {
_this.onReadyShowDone && _this.onReadyShowDone();
}; // onReadyShowDone

this.player.onRelease = () => {
// isReportNetworkErr = false;
controller.abort();
};

/*
*
* Set Events
Expand Down
2 changes: 1 addition & 1 deletion src/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20211129');
require('./h265webjs-v20211204');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
24 changes: 23 additions & 1 deletion src/src/render-engine/webgl-420p.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,27 @@ function renderFrame(gl,
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}

// release
function releaseContext(gl) {
// gl.y = new Texture(gl);
// gl.u = new Texture(gl);
// gl.v = new Texture(gl);
// gl.y.bind(0, program, "YTexture");
// gl.u.bind(1, program, "UTexture");
// gl.v.bind(2, program, "VTexture");

// this.texture = gl.createTexture();
// gl.bindTexture(gl.TEXTURE_2D, this.texture);

gl.deleteTexture(gl.y.texture);
gl.deleteTexture(gl.u.texture);
gl.deleteTexture(gl.v.texture);
// gl.deleteBuffer(someBuffer);
// gl.deleteBuffer(someOtherBuffer);
// gl.deleteRenderbuffer(someRenderbuffer);
// gl.deleteFramebuffer(someFramebuffer);
}


/* Player controls Start Here */

Expand Down Expand Up @@ -204,7 +225,8 @@ function fullscreen() {

module.exports = {
renderFrame : renderFrame,
setupCanvas : setupCanvas
setupCanvas : setupCanvas,
releaseContext : releaseContext
};

/* Player controls Ends Here */
2 changes: 1 addition & 1 deletion src/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# * Github: https://github.com/numberwolf/h265web.js
# *
# **********************************************************/
VERSION='v20211129' # output version + index.js
VERSION='v20211204' # output version + index.js

0 comments on commit 6ba5a0d

Please sign in to comment.