wenjiegit

fixbug[play packet decode bug: srs only read bool type play reset value, actuall…

…y this value can be bool or number]

783 字节 | 宽: | 高:

783 字节 | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖
不能预览此文件类型
<<<<<<< HEAD
// for bw to init url
// url: scheme://host:port/path?query#fragment
function srs_init_bwt(rtmp_url, hls_url) {
update_nav();
if (rtmp_url) {
//var query = parse_query_string();
var search_filed = String(window.location.search).replace(" ", "").split("?")[1];
$(rtmp_url).val("rtmp://" + window.location.host + ":" + 1935 + "/app?" + search_filed);
}
if (hls_url) {
$(hls_url).val(build_default_hls_url());
}
}
function srs_bwt_check_url(url) {
if (url.indexOf("key") != -1 && url.indexOf("vhost") != -1) {
return true;
}
return false;
}
function srs_bwt_build_default_url() {
var url_default = "rtmp://" + window.location.host + ":" + 1935 + "/app?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com";
return url_default;
=======
/**
* the SrsBandwidth object.
* @param container the html container id.
... ... @@ -161,5 +133,4 @@ function __srs_on_update_status(id, status) {
var bandwidth = __srs_find_bandwidth(id);
bandwidth.status = status;
bandwidth.on_update_status(status);
>>>>>>> upstream/master
}
\ No newline at end of file
... ...
... ... @@ -57,7 +57,7 @@
// get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
// url set to: rtmp://demo:1935/live/livestream
//srs_init("#txt_url", null, "#main_modal");
srs_init("#txt_url", null, "#main_modal");
$("#main_modal").on("hide", function(){
osmf_play("http://localhost");
... ...
... ... @@ -12,119 +12,12 @@
<script type="text/javascript" src="js/srs.player.js"></script>
<script type="text/javascript" src="js/srs.publisher.js"></script>
<script type="text/javascript" src="js/srs.utility.js"></script>
<<<<<<< HEAD
<script type="text/javascript" src="js/srs.utility.js"></script>
<script type="text/javascript" src="js/srs.bandwidth.js"></script>
=======
<script type="text/javascript" src="js/srs.bandwidth.js"></script>
>>>>>>> upstream/master
<style>
body{
padding-top: 55px;
}
#main_modal {
<<<<<<< HEAD
width: 600px;
margin-left: -300px;
}
#check_status {
margin-left: 20px;
margin-top: -55px;
}
#pb_buffer_bg {
margin-top: 40px;
margin-bottom: 10px;
}
</style>
<script type="text/javascript">
function update_progress(percent) {
$("#progress_bar").width(percent);
}
function progress_reset() {
$("#progress_bar").width("0%");
}
function update_status(text) {
$("#check_status").text(text);
}
function get_swf_width() {
return 1;
}
function get_swf_height() {
return 1;
}
function show_modal() {
$("#main_modal").modal({show:true, keyboard:false});
}
function band_check(url) {
// remove flash contet
var bw_div = $("<div/>");
$(bw_div).attr("id", "bw_div");
$("#bw_center").append(bw_div);
var flashvars = {};
flashvars.url = url;
flashvars.update_progress = "update_progress";
flashvars.progress_reset = "progress_reset";
flashvars.update_status = "update_status";
var params = {};
params.allowFullScreen = true;
var attributes = {};
swfobject.embedSWF(
"srs_bwt/release/srs_bwt.swf", "bw_div",
get_swf_width(), get_swf_height(),
"11.1.0", "js/AdobeFlashPlayerInstall.swf",
flashvars, params, attributes
);
}
$(function(){
update_nav();
srs_init_bwt("#txt_url");
var txt_input = $("#txt_url").val();
// if valid ?
if (!srs_bwt_check_url(txt_input)) {
$("#txt_url").val(srs_bwt_build_default_url());
}
$("#main_modal").on(
"show",
function()
{
progress_reset();
update_status("");
var url = $("#txt_url").val();
/*!
url encode
*/
url = escape(url);
band_check(url);
}
);
$("#main_modal").on("hide", function(){
$("#bw_div").remove();
});
$("#btn_play").click(
function()
{
$("#main_modal").modal({show:true, keyboard:false});
}
);
});
=======
width: 700px;
margin-left: -350px;
}
... ... @@ -173,7 +66,6 @@
function on_stop_bandwidth_test() {
bandwidth.stop();
}
>>>>>>> upstream/master
</script>
</head>
<body>
... ... @@ -196,31 +88,6 @@
</div>
</div>
<div class="container">
<<<<<<< HEAD
<div class="form-inline">
URL:
<input type="text" id="txt_url" class="input-xxlarge" value="" placeholder="例如:rtmp://host:port/app?key=xx&vhost=yy"></input>
<button class="btn btn-primary" id="btn_play">开始测速</button>
</div>
<div id="main_modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>SRS Band Check</h3>
</div>
<div class="modal-body">
<div id="player"></div>
<div class="progress progress-striped active" id="pb_buffer_bg">
<div class="bar" style="width: 50%;" id="progress_bar"></div>
</div>
</div>
<div class="modal-body" id="bw_center">
</div>
<span id="check_status1"><font ><strong id="check_status">status</strong></font> </span>
=======
<div class="alert alert-info fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong><span>Usage:</span></strong> <span>点击“开始测速”即可测带宽,最大可测试带宽由服务器限制</span>
... ... @@ -247,15 +114,10 @@
</div>
<span id="check_status">status</span>
</div>
>>>>>>> upstream/master
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
</div>
</div>
<<<<<<< HEAD
=======
>>>>>>> upstream/master
<hr>
<footer>
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team &copy; 2013</a></p>
... ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="srs_bwt.as" projectUUID="00251213-e6a2-4dd5-a033-125cc78f843c" version="10">
<<<<<<< HEAD
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
=======
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="release" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
>>>>>>> upstream/master
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
... ... @@ -21,15 +17,6 @@
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<<<<<<< HEAD
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
=======
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
... ... @@ -37,7 +24,6 @@
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
>>>>>>> upstream/master
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
... ...
... ... @@ -20,12 +20,6 @@ package
public class srs_bwt extends Sprite
{
<<<<<<< HEAD
private var connection:NetConnection;
private var updatePlayProgressTimer:Timer;
private var elapTimer:SrsElapsedTimer;
=======
private var connection:NetConnection = null;
private var updatePlayProgressTimer:Timer = null;
... ... @@ -35,7 +29,6 @@ package
private var js_id:String = null;
// play param url.
private var user_url:String = null;
>>>>>>> upstream/master
// server ip get from server
private var server_ip:String;
... ... @@ -44,13 +37,8 @@ package
private var stop_pub:Boolean = false;
// js interface
<<<<<<< HEAD
private var js_update_progress:String;
private var js_progress_reset:String;
=======
private var js_on_player_ready:String;
private var js_update_progress:String;
>>>>>>> upstream/master
private var js_update_status:String;
private var value_progressbar:Number = 0;
... ... @@ -61,8 +49,6 @@ package
public function srs_bwt()
{
<<<<<<< HEAD
=======
if (!this.stage) {
this.addEventListener(Event.ADDED_TO_STAGE, this.system_on_add_to_stage);
} else {
... ... @@ -75,23 +61,10 @@ package
* the main function.
*/
private function system_on_add_to_stage(evt:Event):void {
>>>>>>> upstream/master
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
var flashvars:Object = this.root.loaderInfo.parameters;
<<<<<<< HEAD
this.js_update_progress = flashvars.update_progress;
this.js_progress_reset = flashvars.progress_reset;
this.js_update_status = flashvars.update_status;
// init context menu, add action "Srs 带宽测试工具 0.1"
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
myMenu.customItems.push(new ContextMenuItem("Srs 带宽测试工具 0.1", true));
this.contextMenu = myMenu;
=======
if (!flashvars.hasOwnProperty("id")) {
throw new Error("must specifies the id");
... ... @@ -131,16 +104,11 @@ package
private function js_call_check_bandwidth(url:String):void {
js_call_stop();
>>>>>>> upstream/master
// init connection
connection = new NetConnection;
connection.client = this;
connection.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
<<<<<<< HEAD
connection.connect(flashvars.url);
=======
connection.connect(url);
>>>>>>> upstream/master
//connection.connect("rtmp://192.168.8.234:1935/app?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com");
// for play to update progress bar
... ... @@ -151,12 +119,6 @@ package
updatePlayProgressTimer.addEventListener(TimerEvent.TIMER, onTimerTimeout);
updatePlayProgressTimer.start();
}
<<<<<<< HEAD
// get NetConnection NetStatusEvent
public function onStatus(evt:NetStatusEvent) : void{
trace(evt.info.code);
=======
private function js_call_stop():void {
if (connection) {
connection.close();
... ... @@ -187,7 +149,6 @@ package
contextMenu.customItems = customItems;
}
>>>>>>> upstream/master
switch(evt.info.code){
case "NetConnection.Connect.Failed":
updateState("连接服务器失败!");
... ... @@ -203,10 +164,6 @@ package
//updateState("连接已断开!");
break;
}
<<<<<<< HEAD
}
=======
}
public function onTimerTimeout(evt:TimerEvent):void
... ... @@ -214,7 +171,6 @@ package
value_progressbar = elapTimer.elapsed();
updateProgess(value_progressbar, max_progressbar);
}
>>>>>>> upstream/master
/**
* NetConnection callback this function, when recv server call "onSrsBandCheckStartPlayBytes"
... ... @@ -225,27 +181,13 @@ package
var interval_ms:Number = evt.interval_ms;
connection.call("onSrsBandCheckStartingPlayBytes", null);
<<<<<<< HEAD
updateState("测试下行带宽(" + server_ip + ")");
=======
updateState("开始测试下行带宽,服务器IP:" + server_ip);
>>>>>>> upstream/master
// we suppose play duration_ms = pub duration_ms
max_progressbar = duration_ms * 2;
}
public function onSrsBandCheckPlaying(evt:Object):void{
<<<<<<< HEAD
}
public function onTimerTimeout(evt:TimerEvent):void
{
value_progressbar = elapTimer.elapsed();
updateProgess(value_progressbar, max_progressbar);
=======
>>>>>>> upstream/master
}
public function onSrsBandCheckStopPlayBytes(evt:Object):void{
... ... @@ -261,10 +203,7 @@ package
kbps = (int(kbps * 10))/10.0;
flash.utils.setTimeout(stopPlayTest, 0);
<<<<<<< HEAD
=======
updateState("下行带宽测试完毕,服务器: " + server_ip + "," + kbps + "kbps,开始测试上行带宽。");
>>>>>>> upstream/master
}
private function stopPlayTest():void{
... ... @@ -276,10 +215,6 @@ package
var interval_ms:Number = evt.interval_ms;
connection.call("onSrsBandCheckStartingPublishBytes", null);
<<<<<<< HEAD
updateState("测试上行带宽(" + server_ip + ")");
=======
>>>>>>> upstream/master
flash.utils.setTimeout(publisher, 0);
}
... ... @@ -343,35 +278,19 @@ package
connection.call("finalClientPacket", null);
}
<<<<<<< HEAD
public function onBWDone():void{
// do nothing
}
// update progressBar's value
private function updateProgess(value:Number, maxValue:Number):void{
flash.external.ExternalInterface.call(this.js_update_progress, value * 100 / maxValue + "%");
=======
// update progressBar's value
private function updateProgess(value:Number, maxValue:Number):void{
flash.external.ExternalInterface.call(this.js_update_progress, this.js_id, value * 100 / maxValue);
>>>>>>> upstream/master
trace(value + "-" + maxValue + "-" + value * 100 / maxValue + "%");
}
// update checking status
private function updateState(text:String):void{
<<<<<<< HEAD
flash.external.ExternalInterface.call(this.js_update_status, text);
trace(text);
}
=======
flash.external.ExternalInterface.call(this.js_update_status, this.js_id, text);
trace(text);
}
public function onBWDone():void{
}
>>>>>>> upstream/master
}
}
\ No newline at end of file
... ...
... ... @@ -446,17 +446,7 @@ int SrsRtmpClient::publish(string stream, int stream_id)
}
}
return ret;
}
SrsProtocol *SrsRtmpClient::get_protocol()
{
return protocol;
}
st_netfd_t SrsRtmpClient::get_st_fd()
{
return stfd;
return ret;
}
SrsRtmp::SrsRtmp(st_netfd_t client_stfd)
... ...
... ... @@ -131,10 +131,6 @@ public:
virtual int create_stream(int& stream_id);
virtual int play(std::string stream, int stream_id);
virtual int publish(std::string stream, int stream_id);
protected:
SrsProtocol* get_protocol();
st_netfd_t get_st_fd();
};
/**
... ...