Skip to content

Commit

Permalink
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Browse files Browse the repository at this point in the history
  • Loading branch information
numberwolf committed Nov 29, 2021
1 parent 6b7167d commit 2ce0833
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 123 deletions.
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| 更新日志 | 内容 |
| ---- | ---- |
| 时间 | 2021/11/29 - 夜 |
| - | 0.修复 http-flv起播重试问题、修复一些bug |
| 时间 | 2021/11/25 - 夜 |
| - | 0.修复 httpflv/ws直播 ignoreAudio配置失效问题 |
| 时间 | 2021/11/23 - 夜 |
Expand Down
2 changes: 2 additions & 0 deletions README_EN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ ffmpeg -ss 20 -t 10 -i ./res/xinxiaomen.mp4 \

| Update | Content |
| ---- | ---- |
| Time | 2021/11/29 -|
| - | 0.Fixed http-flv retry case and some bugs |
| Time | 2021/11/25 - Night |
| - | 0.Fixed httpflv/ws LIVE ignoreAudio problem |
| Time | 2021/11/23 - Night |
Expand Down
28 changes: 14 additions & 14 deletions dist/h265webjs-v20211125.js → dist/h265webjs-v20211129.js

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-v20211125');
require('./h265webjs-v20211129');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
24 changes: 12 additions & 12 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-v20211125');
require('./h265webjs-v20211129');
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-v20211125');
require('./h265webjs-v20211129');
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-v20211125.js"></script> <!-- IMPORTANT -->
<script src="dist/h265webjs-v20211129.js"></script> <!-- IMPORTANT -->
<script src="example.js"></script> <!-- IMPORTANT -->
<style>
</style>
Expand Down
67 changes: 36 additions & 31 deletions src/src/decoder/av-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,47 +129,52 @@ function frameDataAlignCrop(


function GetUriFormat(uri) {
for (let i = 0; i < Formats.length; i++) {
const formatTag = Formats[i];
const formatRegex = '\.' + formatTag.format;

let patt = formatRegex;
let n = uri.search(patt);

if (n >= 0) {
// alert(formatTag.value);
return formatTag.value;
} // end if
} // end for
if (uri !== undefined && uri !== null) {
for (let i = 0; i < Formats.length; i++) {
const formatTag = Formats[i];
const formatRegex = '\.' + formatTag.format;

let patt = formatRegex;
let n = uri.search(patt);

if (n >= 0) {
// alert(formatTag.value);
return formatTag.value;
} // end if
} // end for
}

return Formats[0].value;
} // GetUriFormat

function GetFormatPlayCore(inputFormat) {
for (let i = 0; i < Formats.length; i++) {
const formatTag = Formats[i];
if (formatTag.value === inputFormat) {
return formatTag.core;
} // end if
} // end for
if (inputFormat !== undefined && inputFormat !== null) {
for (let i = 0; i < Formats.length; i++) {
const formatTag = Formats[i];
if (formatTag.value === inputFormat) {
return formatTag.core;
} // end if
} // end for
}

return Formats[0].core;
} // GetFormatPlayCore

// @TODO
function GetUriProtocol(uri) {
for (let i = 0; i < Protocols.length; i++) {
const formatTag = Protocols[i];
const formatRegex = formatTag.format + '[s]{0,}:\/\/';

let patt = formatRegex;
let n = uri.search(patt);

if (n >= 0) {
// alert(formatTag.value);
return formatTag.value;
} // end if
} // end for
if (uri !== undefined && uri !== null) {
for (let i = 0; i < Protocols.length; i++) {
const formatTag = Protocols[i];
const formatRegex = formatTag.format + '[s]{0,}:\/\/';

let patt = formatRegex;
let n = uri.search(patt);

if (n >= 0) {
// alert(formatTag.value);
return formatTag.value;
} // end if
} // end for
}

return Protocols[0].value;
} // GetUriFormat
Expand Down
91 changes: 62 additions & 29 deletions src/src/decoder/c-httplive-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,33 +185,9 @@ class CHttpLiveCoreModule { // export default
}
// console.log("play -> workerFetch recv cmd:", cmd);
switch (cmd) {
case 'fetch-chunk':
//console.log("play -> workerFetch append chunk");
let chunk = body.data;
_this.download_length += chunk.length;

let push_ret = 0;
setTimeout(function() {
let offset_video = Module._malloc(chunk.length);
Module.HEAP8.set(chunk, offset_video);

// console.warn("_this.AVSniffPtr:", _this);
push_ret = Module.cwrap("pushSniffHttpFlvData", "number", ["number", "number", "number", "number"])(
_this.AVSniffPtr, offset_video, chunk.length, _this.config.probeSize
);
// console.warn("pushRet:", push_ret);

Module._free(offset_video);
offset_video = null;
}, 0); // end setTimeout

_this.totalLen += chunk.length;
//console.log("play -> workerFetch append chunk ret: ", push_ret, chunk.length, totalLen);
if (chunk.length > 0) {
_this.getPackageTimeMS = AVCommon.GetMsTime();
}
_this.pushPkg++;

case 'startok':
alert("startok");
_this.getPackageTimeMS = AVCommon.GetMsTime();
// /*
if (_this.AVGetInterval === undefined
|| _this.AVGetInterval === null)
Expand Down Expand Up @@ -242,6 +218,63 @@ class CHttpLiveCoreModule { // export default
}, 5);
} // end if AVGetInterval
break;
case 'fetch-chunk':
//console.log("play -> workerFetch append chunk");
let chunk = body.data;
_this.download_length += chunk.length;

let push_ret = 0;
setTimeout(function() {
let offset_video = Module._malloc(chunk.length);
Module.HEAP8.set(chunk, offset_video);

// console.warn("_this.AVSniffPtr:", _this);
push_ret = Module.cwrap("pushSniffHttpFlvData", "number", ["number", "number", "number", "number"])(
_this.AVSniffPtr, offset_video, chunk.length, _this.config.probeSize
);
// console.warn("pushRet:", push_ret);

Module._free(offset_video);
offset_video = null;
}, 0); // end setTimeout

_this.totalLen += chunk.length;
//console.log("play -> workerFetch append chunk ret: ", push_ret, chunk.length, totalLen);
if (chunk.length > 0) {
_this.getPackageTimeMS = AVCommon.GetMsTime();
}
_this.pushPkg++;

// // /*
// if (_this.AVGetInterval === undefined
// || _this.AVGetInterval === null)
// {
// _this.AVGetInterval = window.setInterval(function() {
// let bufLen = Module.cwrap("getBufferLengthApi", "number", ["number"])(_this.AVSniffPtr);
// // console.log("play -> workerFetch last buf len: ", bufLen);
// if (bufLen > _this.config.probeSize) {
// // if (pushPkg > READY_PUSH_COUNT_LIMIT) {
// let get_ret = Module.cwrap("getSniffHttpFlvPkg", "number", ["number"])(_this.AVSniffPtr);
// // console.log("play -> workerFetch get nalu ret: ", get_ret, _this.pushPkg);
// _this.pushPkg -= 1;
// // _this.ready_now = 1;
// // }
// } else {
// if (_this.getPackageTimeMS > 0 &&
// AVCommon.GetMsTime() - _this.getPackageTimeMS >= def.FETCH_HTTP_FLV_TIMEOUT_MS
// ) {
// console.warn("retry!");
// _this.getPackageTimeMS = AVCommon.GetMsTime();
// _this.workerFetch.postMessage({
// cmd: 'retry',
// data: null,
// msg: 'retry'
// });
// }
// } // end if buf len check
// }, 5);
// } // end if AVGetInterval
break;
case 'close':
_this.AVGetInterval && clearInterval(_this.AVGetInterval);
_this.AVGetInterval = null;
Expand Down Expand Up @@ -912,9 +945,9 @@ class CHttpLiveCoreModule { // export default
urlpath = body.data;
fetchData(urlpath);
self.postMessage({
cmd: 'default',
cmd: 'startok',
data: 'WORKER STARTED',
msg: 'default'
msg: 'startok'
});
break;
case 'stop':
Expand Down
2 changes: 1 addition & 1 deletion src/src/demuxer/mpegts/mpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MPEG_JS_Module {

}

// outside
// @TODO outside
initDemuxer() {
let _this = this;
// this.initState = true;
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-v20211125');
require('./h265webjs-v20211129');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
Expand Down
6 changes: 4 additions & 2 deletions src/src/native/nv-flvjs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ class NvFlvjsCoreModule {
} // makeIt

getSize() {
const width = this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.width;
const height = this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.height;
return {
width: this.videoTag.videoWidth,
height: this.videoTag.videoHeight,
width: width,
height: height
};
} // getSize

Expand Down
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='v20211125' # output version + index.js
VERSION='v20211129' # output version + index.js

0 comments on commit 2ce0833

Please sign in to comment.