Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-04-11 14:13:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
15f651bccd47c386f3ceb902a4a5b665d9ba883b
15f651bc
1 parent
acdd5a82
update demo, support acodec
隐藏空白字符变更
内嵌
并排对比
正在显示
11 个修改的文件
包含
97 行增加
和
20 行删除
trunk/conf/demo.conf
trunk/research/players/js/srs.page.js
trunk/research/players/srs_bwt/release/srs_bwt.swf
trunk/research/players/srs_chat.html
trunk/research/players/srs_player/release/srs_player.swf
trunk/research/players/srs_publisher.html
trunk/research/players/srs_publisher/release/srs_publisher.swf
trunk/research/players/srs_publisher/src/srs_publisher.as
trunk/src/app/srs_app_codec.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_source.cpp
trunk/conf/demo.conf
查看文件 @
15f651b
...
...
@@ -180,9 +180,32 @@ vhost players_pub {
}
}
vhost
players_
pub_rtmp
{
vhost
players_
chat
{
gop_cache
off
;
hls
{
enabled
off
;
}
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
chat_hls
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
30
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=
players_pub
/[
stream
];
}
}
}
vhost
chat_hls
{
hls
{
enabled
on
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
2
;
hls_window
8
;
}
}
...
...
trunk/research/players/js/srs.page.js
查看文件 @
15f651b
...
...
@@ -2,6 +2,9 @@
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// to query the swf anti cache.
function
srs_get_version_code
()
{
return
"1.20"
;
}
/**
* player specified size.
*/
...
...
@@ -9,8 +12,6 @@ function srs_get_player_modal() { return 740; }
function
srs_get_player_width
()
{
return
srs_get_player_modal
()
-
30
;
}
function
srs_get_player_height
()
{
return
srs_get_player_width
()
*
9
/
19
;
}
// to query the swf anti cache.
function
srs_get_version_code
()
{
return
"1.19"
;
}
// get the default vhost for players.
function
srs_get_player_vhost
()
{
return
"players"
;
}
// the api server port, for chat room.
...
...
@@ -23,7 +24,7 @@ function srs_get_srs_http_server_port() { return 8080; }
// if not equals to the player vhost, return the orignal vhost.
function
srs_get_player_publish_vhost
(
src_vhost
)
{
return
(
src_vhost
!=
srs_get_player_vhost
())?
src_vhost
:(
src_vhost
+
"_pub"
);
}
// for chat, use rtmp only vhost, low latecy, without gop cache.
function
srs_get_player_chat_vhost
(
src_vhost
)
{
return
(
src_vhost
!=
srs_get_player_vhost
())?
src_vhost
:(
src_vhost
+
"_
pub_rtmp
"
);
}
function
srs_get_player_chat_vhost
(
src_vhost
)
{
return
(
src_vhost
!=
srs_get_player_vhost
())?
src_vhost
:(
src_vhost
+
"_
chat
"
);
}
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
...
...
@@ -181,7 +182,8 @@ function srs_can_republish() {
// without default values set.
function
srs_initialize_codec_page
(
cameras
,
microphones
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
)
{
$
(
sl_cameras
).
empty
();
for
(
var
i
=
0
;
i
<
cameras
.
length
;
i
++
)
{
...
...
@@ -292,17 +294,25 @@ function srs_initialize_codec_page(
for
(
i
=
0
;
i
<
bitrates
.
length
;
i
++
)
{
$
(
sl_bitrate
).
append
(
"<option value='"
+
bitrates
[
i
]
+
"'>"
+
bitrates
[
i
]
+
" kbps</option"
);
}
$
(
sl_acodec
).
empty
();
var
bitrates
=
[
"speex"
,
"nellymoser"
,
"pcma"
,
"pcmu"
];
for
(
i
=
0
;
i
<
bitrates
.
length
;
i
++
)
{
$
(
sl_acodec
).
append
(
"<option value='"
+
bitrates
[
i
]
+
"'>"
+
bitrates
[
i
]
+
"</option"
);
}
}
/**
* when publisher ready, init the page elements.
*/
function
srs_publisher_initialize_page
(
cameras
,
microphones
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
)
{
srs_initialize_codec_page
(
cameras
,
microphones
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
);
//var profiles = ["baseline", "main"];
...
...
@@ -327,17 +337,22 @@ function srs_publisher_initialize_page(
//var bitrates = ["50", "200", "350", "500", "650", "800",
// "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"];
$
(
sl_bitrate
+
" option[value='500']"
).
attr
(
"selected"
,
true
);
// speex
$
(
sl_acodec
+
" option[value='speex']"
).
attr
(
"selected"
,
true
);
}
/**
* for chat, use low latecy settings.
*/
function
srs_chat_initialize_page
(
cameras
,
microphones
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
)
{
srs_initialize_codec_page
(
cameras
,
microphones
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
);
//var profiles = ["baseline", "main"];
...
...
@@ -362,14 +377,19 @@ function srs_chat_initialize_page(
//var bitrates = ["50", "200", "350", "500", "650", "800",
// "950", "1000", "1200", "1500", "1800", "2000", "3000", "5000"];
$
(
sl_bitrate
+
" option[value='350']"
).
attr
(
"selected"
,
true
);
// speex
$
(
sl_acodec
+
" option[value='speex']"
).
attr
(
"selected"
,
true
);
}
/**
* get the vcodec and acodec.
*/
function
srs_publiser_get_codec
(
vcodec
,
acodec
,
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
sl_cameras
,
sl_microphones
,
sl_vcodec
,
sl_profile
,
sl_level
,
sl_gop
,
sl_size
,
sl_fps
,
sl_bitrate
,
sl_acodec
)
{
acodec
.
codec
=
$
(
sl_acodec
).
val
();
acodec
.
device_code
=
$
(
sl_microphones
).
val
();
acodec
.
device_name
=
$
(
sl_microphones
).
text
();
...
...
trunk/research/players/srs_bwt/release/srs_bwt.swf
查看文件 @
15f651b
不能预览此文件类型
trunk/research/players/srs_chat.html
查看文件 @
15f651b
...
...
@@ -82,7 +82,8 @@
cameras
,
microphones
,
"#sl_cameras"
,
"#sl_microphones"
,
"#sl_vcodec"
,
"#sl_profile"
,
"#sl_level"
,
"#sl_gop"
,
"#sl_size"
,
"#sl_fps"
,
"#sl_bitrate"
"#sl_fps"
,
"#sl_bitrate"
,
"#sl_acodec"
);
};
srs_publisher
.
on_publisher_error
=
function
(
code
,
desc
)
{
...
...
@@ -490,7 +491,8 @@
vcodec
,
acodec
,
"#sl_cameras"
,
"#sl_microphones"
,
"#sl_vcodec"
,
"#sl_profile"
,
"#sl_level"
,
"#sl_gop"
,
"#sl_size"
,
"#sl_fps"
,
"#sl_bitrate"
"#sl_fps"
,
"#sl_bitrate"
,
"#sl_acodec"
);
var
chat
=
{};
...
...
@@ -760,6 +762,17 @@
<select
class=
"span4"
id=
"sl_microphones"
></select>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"sl_acodec"
>
编码
<a
id=
"sl_acodec_tips"
href=
"#"
data-toggle=
"tooltip"
data-placement=
"right"
title=
""
>
<img
src=
"img/tooltip.png"
/>
</a>
</label>
<div
class=
"controls"
>
<select
class=
"span2"
id=
"sl_acodec"
></select>
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
...
...
trunk/research/players/srs_player/release/srs_player.swf
查看文件 @
15f651b
不能预览此文件类型
trunk/research/players/srs_publisher.html
查看文件 @
15f651b
...
...
@@ -67,7 +67,8 @@
cameras
,
microphones
,
"#sl_cameras"
,
"#sl_microphones"
,
"#sl_vcodec"
,
"#sl_profile"
,
"#sl_level"
,
"#sl_gop"
,
"#sl_size"
,
"#sl_fps"
,
"#sl_bitrate"
"#sl_fps"
,
"#sl_bitrate"
,
"#sl_acodec"
);
};
srs_publisher
.
on_publisher_error
=
function
(
code
,
desc
)
{
...
...
@@ -184,7 +185,8 @@
vcodec
,
acodec
,
"#sl_cameras"
,
"#sl_microphones"
,
"#sl_vcodec"
,
"#sl_profile"
,
"#sl_level"
,
"#sl_gop"
,
"#sl_size"
,
"#sl_fps"
,
"#sl_bitrate"
"#sl_fps"
,
"#sl_bitrate"
,
"#sl_acodec"
);
info
(
"开始推流到服务器"
);
...
...
@@ -376,6 +378,17 @@
<select
class=
"span4"
id=
"sl_microphones"
></select>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"sl_acodec"
>
编码
<a
id=
"sl_acodec_tips"
href=
"#"
data-toggle=
"tooltip"
data-placement=
"right"
title=
""
>
<img
src=
"img/tooltip.png"
/>
</a>
</label>
<div
class=
"controls"
>
<select
class=
"span2"
id=
"sl_acodec"
></select>
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
...
...
trunk/research/players/srs_publisher/release/srs_publisher.swf
查看文件 @
15f651b
不能预览此文件类型
trunk/research/players/srs_publisher/src/srs_publisher.as
查看文件 @
15f651b
...
...
@@ -273,7 +273,7 @@ package
var
microRate
:
int
=
22
;
// 22 === 22050 Hz
trace
(
"[Publish] audio encoding parameters: "
+
"audio(microphone) encodeQuality="
+
microEncodeQuality
+
"audio(microphone)
codec="
+
acodec
.
codec
+
"
encodeQuality="
+
microEncodeQuality
+
", rate="
+
microRate
+
"(22050Hz)"
)
;
...
...
@@ -288,7 +288,15 @@ package
m
.
rate
=
microRate
;
// see: http://www.adobe.com/cn/devnet/flashplayer/articles/acoustic-echo-cancellation.html
m
.
codec
=
SoundCodec
.
SPEEX
;
if
(
acodec
.
codec
==
"nellymoser"
)
{
m
.
codec
=
SoundCodec
.
NELLYMOSER
;
}
else
if
(
acodec
.
codec
==
"pcma"
)
{
m
.
codec
=
SoundCodec
.
PCMA
;
}
else
if
(
acodec
.
codec
==
"pcmu"
)
{
m
.
codec
=
SoundCodec
.
PCMU
;
}
else
{
m
.
codec
=
SoundCodec
.
SPEEX
;
}
m
.
framesPerPacket
=
1
;
}
private
function
__build_video_codec
(
stream
:
NetStream
,
c
:
Camera
,
vcodec
:
Object
)
:
void
{
...
...
trunk/src/app/srs_app_codec.cpp
查看文件 @
15f651b
...
...
@@ -189,7 +189,7 @@ int SrsCodec::audio_aac_demux(int8_t* data, int size, SrsCodecSample* sample)
// only support aac
if
(
audio_codec_id
!=
SrsCodecAudioAAC
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"hls only support audio aac codec.
ret=%d"
,
ret
);
srs_error
(
"hls only support audio aac codec.
actual=%d, ret=%d"
,
audio_codec_id
,
ret
);
return
ret
;
}
...
...
@@ -299,7 +299,7 @@ int SrsCodec::video_avc_demux(int8_t* data, int size, SrsCodecSample* sample)
// only support h.264/avc
if
(
codec_id
!=
SrsCodecVideoAVC
)
{
ret
=
ERROR_HLS_DECODE_ERROR
;
srs_error
(
"hls only support video h.264/avc codec.
ret=%d"
,
ret
);
srs_error
(
"hls only support video h.264/avc codec.
actual=%d, ret=%d"
,
codec_id
,
ret
);
return
ret
;
}
video_codec_id
=
codec_id
;
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
15f651b
...
...
@@ -289,7 +289,7 @@ int SrsRtmpConn::stream_service_cycle()
}
bool
enabled_cache
=
_srs_config
->
get_gop_cache
(
req
->
vhost
);
srs_
info
(
"source found, url=%s, enabled_cache=%d"
,
req
->
get_stream_url
().
c_str
(),
enabled_cache
);
srs_
trace
(
"source found, url=%s, enabled_cache=%d"
,
req
->
get_stream_url
().
c_str
(),
enabled_cache
);
source
->
set_cache
(
enabled_cache
);
switch
(
type
)
{
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
15f651b
...
...
@@ -418,7 +418,7 @@ SrsSource* SrsSource::find(SrsRequest* req)
if
(
pool
.
find
(
stream_url
)
==
pool
.
end
())
{
pool
[
stream_url
]
=
new
SrsSource
(
req
);
srs_
verbose
(
"create new source for url=%s, vhost=%s"
,
stream_url
.
c_str
(),
vhost
.
c_str
());
srs_
info
(
"create new source for url=%s, vhost=%s"
,
stream_url
.
c_str
(),
vhost
.
c_str
());
}
return
pool
[
stream_url
];
...
...
请
注册
或
登录
后发表评论