Merge branch 'development' into LTS_development
# Conflicts: # src/output/output_progressive_mp4.cpp
This commit is contained in:
commit
2717c21d4e
16 changed files with 55 additions and 32 deletions
|
@ -42,7 +42,7 @@ MistPlayer.prototype.build = function () {
|
||||||
}
|
}
|
||||||
MistPlayer.prototype.timer = {
|
MistPlayer.prototype.timer = {
|
||||||
timers: {},
|
timers: {},
|
||||||
add: function(callback,delay){
|
add: function(callback,delay,isInterval){
|
||||||
var me = this;
|
var me = this;
|
||||||
var i = setTimeout(function(){
|
var i = setTimeout(function(){
|
||||||
delete me.timers[i];
|
delete me.timers[i];
|
||||||
|
@ -50,19 +50,24 @@ MistPlayer.prototype.timer = {
|
||||||
},delay);
|
},delay);
|
||||||
this.timers[i] = {
|
this.timers[i] = {
|
||||||
delay: delay,
|
delay: delay,
|
||||||
callback: callback
|
callback: callback,
|
||||||
|
interval: isInterval || false
|
||||||
};
|
};
|
||||||
return i;
|
return i;
|
||||||
},
|
},
|
||||||
remove: function(i){
|
remove: function(i){
|
||||||
clearTimeout(i);
|
if (this.timers[i].interval) {
|
||||||
|
clearInterval(i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clearTimeout(i);
|
||||||
|
}
|
||||||
delete this.timers[i];
|
delete this.timers[i];
|
||||||
},
|
},
|
||||||
clear: function(){
|
clear: function(){
|
||||||
for (var i in this.timers) {
|
for (var i in this.timers) {
|
||||||
clearTimeout(i);
|
this.remove(i);
|
||||||
}
|
}
|
||||||
this.timers = {};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -688,6 +693,7 @@ MistPlayer.prototype.askNextCombo = function(msg){
|
||||||
button.appendChild(t);
|
button.appendChild(t);
|
||||||
err.appendChild(button);
|
err.appendChild(button);
|
||||||
button.onclick = function(){
|
button.onclick = function(){
|
||||||
|
me.addlog('Reloading player because the reload button was triggered');
|
||||||
me.reload();
|
me.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,6 +703,7 @@ MistPlayer.prototype.askNextCombo = function(msg){
|
||||||
type: 'playback',
|
type: 'playback',
|
||||||
warn: 'Automatically reloaded the current player after playback error'
|
warn: 'Automatically reloaded the current player after playback error'
|
||||||
});
|
});
|
||||||
|
me.addlog('Triggering reload button because of timeout');
|
||||||
button.click();
|
button.click();
|
||||||
},20e3);
|
},20e3);
|
||||||
|
|
||||||
|
@ -785,6 +792,7 @@ MistPlayer.prototype.unload = function(){
|
||||||
}
|
}
|
||||||
this.timer.clear();
|
this.timer.clear();
|
||||||
this.target.innerHTML = '';
|
this.target.innerHTML = '';
|
||||||
|
this.element.innerHTML = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
function mistCheck(streaminfo,options,embedLog) {
|
function mistCheck(streaminfo,options,embedLog) {
|
||||||
|
@ -1244,7 +1252,7 @@ function mistPlay(streamName,options) {
|
||||||
if ((!element.checkProgressTimeout) && (player.element) && ('currentTime' in player.element)) {
|
if ((!element.checkProgressTimeout) && (player.element) && ('currentTime' in player.element)) {
|
||||||
//check if the progress made is equal to the time spent
|
//check if the progress made is equal to the time spent
|
||||||
var lasttime = player.element.currentTime;
|
var lasttime = player.element.currentTime;
|
||||||
element.checkProgressTimeout = setInterval(function(){
|
element.checkProgressTimeout = player.timer.add(function(){
|
||||||
var newtime = player.element.currentTime;
|
var newtime = player.element.currentTime;
|
||||||
var progress = newtime - lasttime;
|
var progress = newtime - lasttime;
|
||||||
lasttime = newtime;
|
lasttime = newtime;
|
||||||
|
@ -1279,13 +1287,13 @@ function mistPlay(streamName,options) {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},30e3);
|
},30e3,true);
|
||||||
}
|
}
|
||||||
},true);
|
},true);
|
||||||
element.addEventListener('pause',function(){
|
element.addEventListener('pause',function(){
|
||||||
player.paused = true;
|
player.paused = true;
|
||||||
if (element.checkProgressTimeout) {
|
if (element.checkProgressTimeout) {
|
||||||
clearInterval(element.checkProgressTimeout);
|
player.timer.remove(element.checkProgressTimeout);
|
||||||
element.checkProgressTimeout = false;
|
element.checkProgressTimeout = false;
|
||||||
}
|
}
|
||||||
},true);
|
},true);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.dashjs = {
|
mistplayers.dashjs = {
|
||||||
name: 'Dash.js Player',
|
name: 'Dash.js Player',
|
||||||
|
version: '1.1',
|
||||||
mimes: ['dash/video/mp4'],
|
mimes: ['dash/video/mp4'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
@ -131,3 +132,11 @@ p.prototype.resize = function(size){
|
||||||
this.element.width = size.width;
|
this.element.width = size.width;
|
||||||
this.element.height = size.height;
|
this.element.height = size.height;
|
||||||
};
|
};
|
||||||
|
p.prototype.updateSrc = function(src){
|
||||||
|
if (src == '') {
|
||||||
|
this.dash.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.dash.attachSource(src);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.flash_strobe = {
|
mistplayers.flash_strobe = {
|
||||||
name: 'Strobe Flash Media Playback',
|
name: 'Strobe Flash Media Playback',
|
||||||
|
version: '1.0',
|
||||||
mimes: ['flash/10','flash/11','flash/7'],
|
mimes: ['flash/10','flash/11','flash/7'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.html5 = {
|
mistplayers.html5 = {
|
||||||
name: 'HTML5 video player',
|
name: 'HTML5 video player',
|
||||||
|
version: '1.0',
|
||||||
mimes: ['html5/application/vnd.apple.mpegurl','html5/video/mp4','html5/video/ogg','html5/video/webm','html5/audio/mp3','html5/audio/webm','html5/audio/ogg','html5/audio/wav'],
|
mimes: ['html5/application/vnd.apple.mpegurl','html5/video/mp4','html5/video/ogg','html5/video/webm','html5/audio/mp3','html5/audio/webm','html5/audio/ogg','html5/audio/wav'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.img = {
|
mistplayers.img = {
|
||||||
name: 'HTML img tag',
|
name: 'HTML img tag',
|
||||||
|
version: '1.0',
|
||||||
mimes: ['html5/image/jpeg'],
|
mimes: ['html5/image/jpeg'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.jwplayer = {
|
mistplayers.jwplayer = {
|
||||||
name: 'JWPlayer',
|
name: 'JWPlayer',
|
||||||
|
version: '0.1',
|
||||||
mimes: ['html5/video/mp4','html5/video/webm','dash/video/mp4','flash/10','flash/7','html5/application/vnd.apple.mpegurl','html5/audio/mp3','html5/audio/aac'],
|
mimes: ['html5/video/mp4','html5/video/webm','dash/video/mp4','flash/10','flash/7','html5/application/vnd.apple.mpegurl','html5/audio/mp3','html5/audio/aac'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.polytrope = {
|
mistplayers.polytrope = {
|
||||||
name: 'Polytrope Flash Player',
|
name: 'Polytrope Flash Player',
|
||||||
|
version: '0.1',
|
||||||
mimes: ['flash/11','flash/10','flash/7'],
|
mimes: ['flash/11','flash/10','flash/7'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.silverlight = {
|
mistplayers.silverlight = {
|
||||||
name: 'Silverlight',
|
name: 'Silverlight',
|
||||||
|
version: '1.0',
|
||||||
mimes: ['silverlight'],
|
mimes: ['silverlight'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.myplayer = {
|
mistplayers.myplayer = {
|
||||||
name: 'My video player',
|
name: 'My video player',
|
||||||
|
version: '0.1',
|
||||||
mimes: ['my/mime/types'],
|
mimes: ['my/mime/types'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.theoplayer = {
|
mistplayers.theoplayer = {
|
||||||
name: 'TheoPlayer',
|
name: 'TheoPlayer',
|
||||||
|
version: '0.1',
|
||||||
mimes: ['html5/application/vnd.apple.mpegurl','dash/video/mp4'],
|
mimes: ['html5/application/vnd.apple.mpegurl','dash/video/mp4'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mistplayers.videojs = {
|
mistplayers.videojs = {
|
||||||
name: 'VideoJS player',
|
name: 'VideoJS player',
|
||||||
|
version: '1.0',
|
||||||
mimes: ['html5/video/mp4','html5/application/vnd.apple.mpegurl','html5/video/ogg','html5/video/webm'],
|
mimes: ['html5/video/mp4','html5/application/vnd.apple.mpegurl','html5/video/ogg','html5/video/webm'],
|
||||||
priority: Object.keys(mistplayers).length + 1,
|
priority: Object.keys(mistplayers).length + 1,
|
||||||
isMimeSupported: function (mimetype) {
|
isMimeSupported: function (mimetype) {
|
||||||
|
|
|
@ -67,9 +67,9 @@ top:a,left:d,right:"auto",bottom:"auto"})});a.parent().on("dragleave",function()
|
||||||
"days, ")).append(UI.format.addUnit(d.hr,"hrs"));break;default:b.append([("0"+d.hr).slice(-2),("0"+d.min).slice(-2),("0"+d.sec).slice(-2)+(d.ms?"."+d.ms:"")].join(":"))}return b[0].innerHTML},number:function(a){if(isNaN(Number(a))||0==a)return a;var b=Math.pow(10,3-Math.floor(Math.log(a)/Math.LN10)-1),a=Math.round(a*b)/b;if(1E4<a){number=a.toString().split(".");for(a=/(\d+)(\d{3})/;a.test(number[0]);)number[0]=number[0].replace(a,"$1 $2");a=number.join(".")}return a},status:function(a){var b=$("<span>");
|
"days, ")).append(UI.format.addUnit(d.hr,"hrs"));break;default:b.append([("0"+d.hr).slice(-2),("0"+d.min).slice(-2),("0"+d.sec).slice(-2)+(d.ms?"."+d.ms:"")].join(":"))}return b[0].innerHTML},number:function(a){if(isNaN(Number(a))||0==a)return a;var b=Math.pow(10,3-Math.floor(Math.log(a)/Math.LN10)-1),a=Math.round(a*b)/b;if(1E4<a){number=a.toString().split(".");for(a=/(\d+)(\d{3})/;a.test(number[0]);)number[0]=number[0].replace(a,"$1 $2");a=number.join(".")}return a},status:function(a){var b=$("<span>");
|
||||||
if("undefined"==typeof a.online)return b.text("Unknown, checking.."),"undefined"!=typeof a.error&&b.text(a.error),b;switch(a.online){case -1:b.text("Enabling");break;case 0:b.text("Unavailable").addClass("red");break;case 1:b.text("Active").addClass("green");break;case 2:b.text("Standby").addClass("orange");break;default:b.text(a.online)}"error"in a&&b.text(a.error);return b},capital:function(a){return a.charAt(0).toUpperCase()+a.substring(1)},addUnit:function(a,b){var c=$("<span>").html(a);c.append($("<span>").addClass("unit").html(b));
|
if("undefined"==typeof a.online)return b.text("Unknown, checking.."),"undefined"!=typeof a.error&&b.text(a.error),b;switch(a.online){case -1:b.text("Enabling");break;case 0:b.text("Unavailable").addClass("red");break;case 1:b.text("Active").addClass("green");break;case 2:b.text("Standby").addClass("orange");break;default:b.text(a.online)}"error"in a&&b.text(a.error);return b},capital:function(a){return a.charAt(0).toUpperCase()+a.substring(1)},addUnit:function(a,b){var c=$("<span>").html(a);c.append($("<span>").addClass("unit").html(b));
|
||||||
return c[0].innerHTML},bytes:function(a,b){var c="bytes KiB MiB GiB TiB PiB".split(" ");if(0==a)unit=c[0];else{var d=Math.floor(Math.log(Math.abs(a))/Math.log(1024));0>d?unit=c[0]:(a/=Math.pow(1024,d),unit=c[d])}return UI.format.addUnit(UI.format.number(a),unit+(b?"/s":""))}},navto:function(a,b){var c=location.hash,d=c.split("@");d[0]=[mist.user.name,mist.user.host].join("&");d[1]=[a,b].join("&");"undefined"!=typeof screenlog&&screenlog.navto(d[1]);location.hash=d.join("@");location.hash==c&&$(window).trigger("hashchange")},
|
return c[0].innerHTML},bytes:function(a,b){var c="bytes KiB MiB GiB TiB PiB".split(" ");if(0==a)unit=c[0];else{var d=Math.floor(Math.log(Math.abs(a))/Math.log(1024));0>d?unit=c[0]:(a/=Math.pow(1024,d),unit=c[d])}return UI.format.addUnit(UI.format.number(a),unit+(b?"/s":""))}},navto:function(a,b){var c=location.hash,d=c.split("@");d[0]=[mist.user.name,mist.user.host].join("&");d[1]=[a,b].join("&");"undefined"!=typeof screenlog&&screenlog.navto(d[1]);location.hash=d.join("@");location.hash==c&&$(window).trigger("hashchange")},
|
||||||
showTab:function(a,b){var c=UI.elements.main;if(mist.user.loggedin&&!("ui_settings"in mist.data))c.html("Loading.."),mist.send(function(){UI.showTab(a,b)},{ui_settings:!0});else{var d=UI.elements.menu.removeClass("hide").find('.plain:contains("'+a+'")').closest(".button");0<d.length&&(UI.elements.menu.find(".button.active").removeClass("active"),d.addClass("active"));if("undefined"!=typeof mistvideo)for(var e in mistvideo)if("embedded"in mistvideo[e])for(var g in mistvideo[e].embedded)try{mistvideo[e].embedded[g].player.unload()}catch(m){}UI.interval.clear();
|
showTab:function(a,b){var c=UI.elements.main;if(mist.user.loggedin&&!("ui_settings"in mist.data))c.html("Loading.."),mist.send(function(){UI.showTab(a,b)},{ui_settings:!0});else{var d=UI.elements.menu.removeClass("hide").find('.plain:contains("'+a+'")').closest(".button");0<d.length&&(UI.elements.menu.find(".button.active").removeClass("active"),d.addClass("active"));if("undefined"!=typeof mistvideo)for(var e in mistvideo)if("embedded"in mistvideo[e])for(var g in mistvideo[e].embedded)try{mistvideo[e].embedded[g].player.unload(),
|
||||||
c.html($("<h2>").text(a));switch(a){case "Login":if(mist.user.loggedin){UI.navto("Overview");return}UI.elements.menu.addClass("hide");UI.elements.connection.status.text("Disconnected").removeClass("green").addClass("red");c.append(UI.buildUI([{type:"help",help:"Please provide your account details.<br>You were asked to set these when MistController was started for the first time. If you did not yet set any account details, log in with your desired credentials to create a new account."},{label:"Host",
|
delete mistvideo[e].embedded[g]}catch(m){}UI.interval.clear();c.html($("<h2>").text(a));switch(a){case "Login":if(mist.user.loggedin){UI.navto("Overview");return}UI.elements.menu.addClass("hide");UI.elements.connection.status.text("Disconnected").removeClass("green").addClass("red");c.append(UI.buildUI([{type:"help",help:"Please provide your account details.<br>You were asked to set these when MistController was started for the first time. If you did not yet set any account details, log in with your desired credentials to create a new account."},
|
||||||
help:"Url location of the MistServer API. Generally located at http://MistServerIP:4242/api","default":"http://localhost:4242/api",pointer:{main:mist.user,index:"host"}},{label:"Username",help:"Please enter your username here.",validate:["required"],pointer:{main:mist.user,index:"name"}},{label:"Password",type:"password",help:"Please enter your password here.",validate:["required"],pointer:{main:mist.user,index:"rawpassword"}},{type:"buttons",buttons:[{label:"Login",type:"save","function":function(){mist.user.password=
|
{label:"Host",help:"Url location of the MistServer API. Generally located at http://MistServerIP:4242/api","default":"http://localhost:4242/api",pointer:{main:mist.user,index:"host"}},{label:"Username",help:"Please enter your username here.",validate:["required"],pointer:{main:mist.user,index:"name"}},{label:"Password",type:"password",help:"Please enter your password here.",validate:["required"],pointer:{main:mist.user,index:"rawpassword"}},{type:"buttons",buttons:[{label:"Login",type:"save","function":function(){mist.user.password=
|
||||||
MD5(mist.user.rawpassword);delete mist.user.rawpassword;mist.send(function(){UI.navto("Overview")})}}]}]));break;case "Create a new account":UI.elements.menu.addClass("hide");c.append($("<p>").text("No account has been created yet in the MistServer at ").append($("<i>").text(mist.user.host)).append("."));c.append(UI.buildUI([{type:"buttons",buttons:[{label:"Select other host",type:"cancel",css:{"float":"left"},"function":function(){UI.navto("Login")}}]},{type:"custom",custom:$("<br>")},{label:"Desired username",
|
MD5(mist.user.rawpassword);delete mist.user.rawpassword;mist.send(function(){UI.navto("Overview")})}}]}]));break;case "Create a new account":UI.elements.menu.addClass("hide");c.append($("<p>").text("No account has been created yet in the MistServer at ").append($("<i>").text(mist.user.host)).append("."));c.append(UI.buildUI([{type:"buttons",buttons:[{label:"Select other host",type:"cancel",css:{"float":"left"},"function":function(){UI.navto("Login")}}]},{type:"custom",custom:$("<br>")},{label:"Desired username",
|
||||||
type:"str",validate:["required"],help:"Enter your desired username. In the future, you will need this to access the Management Interface.",pointer:{main:mist.user,index:"name"}},{label:"Desired password",type:"password",validate:["required",function(a,b){$(".match_password").not($(b)).trigger("change");return false}],help:"Enter your desired password. In the future, you will need this to access the Management Interface.",pointer:{main:mist.user,index:"rawpassword"},classes:["match_password"]},{label:"Repeat password",
|
type:"str",validate:["required"],help:"Enter your desired username. In the future, you will need this to access the Management Interface.",pointer:{main:mist.user,index:"name"}},{label:"Desired password",type:"password",validate:["required",function(a,b){$(".match_password").not($(b)).trigger("change");return false}],help:"Enter your desired password. In the future, you will need this to access the Management Interface.",pointer:{main:mist.user,index:"rawpassword"},classes:["match_password"]},{label:"Repeat password",
|
||||||
type:"password",validate:["required",function(a,b){return a!=$(".match_password").not($(b)).val()?{msg:'The fields "Desired password" and "Repeat password" do not match.',classes:["red"]}:false}],help:"Repeat your desired password.",classes:["match_password"]},{type:"buttons",buttons:[{type:"save",label:"Create new account","function":function(){mist.send(function(){UI.navto("Account created")},{authorize:{new_username:mist.user.name,new_password:mist.user.rawpassword}});mist.user.password=MD5(mist.user.rawpassword);
|
type:"password",validate:["required",function(a,b){return a!=$(".match_password").not($(b)).val()?{msg:'The fields "Desired password" and "Repeat password" do not match.',classes:["red"]}:false}],help:"Repeat your desired password.",classes:["match_password"]},{type:"buttons",buttons:[{type:"save",label:"Create new account","function":function(){mist.send(function(){UI.navto("Account created")},{authorize:{new_username:mist.user.name,new_password:mist.user.rawpassword}});mist.user.password=MD5(mist.user.rawpassword);
|
||||||
|
|
|
@ -1839,6 +1839,7 @@ var UI = {
|
||||||
for (var i in mistvideo[s].embedded) {
|
for (var i in mistvideo[s].embedded) {
|
||||||
try {
|
try {
|
||||||
mistvideo[s].embedded[i].player.unload();
|
mistvideo[s].embedded[i].player.unload();
|
||||||
|
delete mistvideo[s].embedded[i];
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
namespace Mist {
|
namespace Mist {
|
||||||
inputBuffer::inputBuffer(Util::Config * cfg) : Input(cfg) {
|
inputBuffer::inputBuffer(Util::Config * cfg) : Input(cfg) {
|
||||||
|
liveMeta = 0;
|
||||||
capa["name"] = "Buffer";
|
capa["name"] = "Buffer";
|
||||||
JSON::Value option;
|
JSON::Value option;
|
||||||
option["arg"] = "integer";
|
option["arg"] = "integer";
|
||||||
|
@ -138,10 +139,11 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char pageName[NAME_BUFFER_SIZE];
|
if (liveMeta){
|
||||||
snprintf(pageName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
liveMeta->unlink();
|
||||||
IPC::semaphore liveMeta(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
delete liveMeta;
|
||||||
liveMeta.unlink();
|
liveMeta = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,13 +165,9 @@ namespace Mist {
|
||||||
memset(tmp.mapped, 0xFF, size);
|
memset(tmp.mapped, 0xFF, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Delete the live stream semaphore, if any.
|
||||||
|
if (liveMeta){liveMeta->unlink();}
|
||||||
{
|
{
|
||||||
//Delete the live stream semaphore, if any.
|
|
||||||
snprintf(pageName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
|
||||||
IPC::semaphore liveMeta(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
|
||||||
liveMeta.unlink();
|
|
||||||
}{
|
|
||||||
//Delete the stream index metapage.
|
//Delete the stream index metapage.
|
||||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
||||||
IPC::sharedPage erasePage(pageName, DEFAULT_STRM_PAGE_SIZE, false, false);
|
IPC::sharedPage erasePage(pageName, DEFAULT_STRM_PAGE_SIZE, false, false);
|
||||||
|
@ -336,10 +334,13 @@ namespace Mist {
|
||||||
myMeta.bufferWindow = lastms - firstms;
|
myMeta.bufferWindow = lastms - firstms;
|
||||||
myMeta.vod = false;
|
myMeta.vod = false;
|
||||||
myMeta.live = true;
|
myMeta.live = true;
|
||||||
static char liveSemName[NAME_BUFFER_SIZE];
|
if (!liveMeta){
|
||||||
snprintf(liveSemName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
static char liveSemName[NAME_BUFFER_SIZE];
|
||||||
IPC::semaphore liveMeta(liveSemName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
snprintf(liveSemName, NAME_BUFFER_SIZE, SEM_LIVE, streamName.c_str());
|
||||||
liveMeta.wait();
|
liveMeta = new IPC::semaphore(liveSemName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
|
}
|
||||||
|
liveMeta->wait();
|
||||||
|
|
||||||
if (!nProxy.metaPages.count(0) || !nProxy.metaPages[0].mapped) {
|
if (!nProxy.metaPages.count(0) || !nProxy.metaPages[0].mapped) {
|
||||||
char pageName[NAME_BUFFER_SIZE];
|
char pageName[NAME_BUFFER_SIZE];
|
||||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str());
|
||||||
|
@ -348,7 +349,7 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
myMeta.writeTo(nProxy.metaPages[0].mapped);
|
myMeta.writeTo(nProxy.metaPages[0].mapped);
|
||||||
memset(nProxy.metaPages[0].mapped + myMeta.getSendLen(), 0, (nProxy.metaPages[0].len > myMeta.getSendLen() ? std::min(nProxy.metaPages[0].len - myMeta.getSendLen(), 4ll) : 0));
|
memset(nProxy.metaPages[0].mapped + myMeta.getSendLen(), 0, (nProxy.metaPages[0].len > myMeta.getSendLen() ? std::min(nProxy.metaPages[0].len - myMeta.getSendLen(), 4ll) : 0));
|
||||||
liveMeta.post();
|
liveMeta->post();
|
||||||
}
|
}
|
||||||
|
|
||||||
///Checks if removing a key from this track is allowed/safe, and if so, removes it.
|
///Checks if removing a key from this track is allowed/safe, and if so, removes it.
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Mist {
|
||||||
unsigned int lastReTime; /*LTS*/
|
unsigned int lastReTime; /*LTS*/
|
||||||
bool hasPush;
|
bool hasPush;
|
||||||
bool resumeMode;
|
bool resumeMode;
|
||||||
|
IPC::semaphore * liveMeta;
|
||||||
protected:
|
protected:
|
||||||
//Private Functions
|
//Private Functions
|
||||||
bool setup();
|
bool setup();
|
||||||
|
|
|
@ -757,10 +757,6 @@ namespace Mist {
|
||||||
std::stringstream rangeReply;
|
std::stringstream rangeReply;
|
||||||
rangeReply << "bytes " << byteStart << "-" << byteEnd << "/" << fileSize;
|
rangeReply << "bytes " << byteStart << "-" << byteEnd << "/" << fileSize;
|
||||||
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
||||||
//do not multiplex requests that are > 1MiB
|
|
||||||
if (byteEnd - byteStart + 1 > 1024 * 1024) {
|
|
||||||
H.SetHeader("MistMultiplex", "No");
|
|
||||||
}
|
|
||||||
H.SetHeader("Content-Range", rangeReply.str());
|
H.SetHeader("Content-Range", rangeReply.str());
|
||||||
/// \todo Switch to chunked?
|
/// \todo Switch to chunked?
|
||||||
H.SendResponse("206", "Partial content", myConn);
|
H.SendResponse("206", "Partial content", myConn);
|
||||||
|
@ -770,8 +766,6 @@ namespace Mist {
|
||||||
if (!myMeta.live) {
|
if (!myMeta.live) {
|
||||||
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
H.SetHeader("Content-Length", byteEnd - byteStart + 1);
|
||||||
}
|
}
|
||||||
//do not multiplex requests that aren't ranged
|
|
||||||
H.SetHeader("MistMultiplex", "No");
|
|
||||||
/// \todo Switch to chunked?
|
/// \todo Switch to chunked?
|
||||||
H.SendResponse("200", "OK", myConn);
|
H.SendResponse("200", "OK", myConn);
|
||||||
//HTTP_S.StartResponse(HTTP_R, conn);
|
//HTTP_S.StartResponse(HTTP_R, conn);
|
||||||
|
|
Loading…
Add table
Reference in a new issue