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
2013-11-23 20:16:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4f3cdd51c1fcf369f4b7eb8c7dba84729effe1cd
4f3cdd51
1 parent
200a6a69
change metadata. add hls class.
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
51 行增加
和
16 行删除
trunk/configure
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_hls.cpp
trunk/src/core/srs_core_hls.hpp
trunk/src/core/srs_core_source.cpp
trunk/src/core/srs_core_source.hpp
trunk/configure
100755 → 100644
查看文件 @
4f3cdd5
...
...
@@ -114,7 +114,8 @@ MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
"srs_core_autofree"
"srs_core_protocol"
"srs_core_amf0"
"srs_core_stream"
"srs_core_source"
"srs_core_codec"
"srs_core_handshake"
"srs_core_pithy_print"
"srs_core_config"
"srs_core_refer"
"srs_core_reload"
)
"srs_core_config"
"srs_core_refer"
"srs_core_reload"
"srs_core_hls"
)
MODULE_DIR
=
"src/core"
. auto/modules.sh
CORE_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
...
...
trunk/src/core/srs_core_client.cpp
查看文件 @
4f3cdd5
...
...
@@ -36,6 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_pithy_print.hpp>
#include <srs_core_config.hpp>
#include <srs_core_refer.hpp>
#include <srs_core_hls.hpp>
#define SRS_PULSE_TIMEOUT_MS 100
#define SRS_SEND_TIMEOUT_MS 5000000L
...
...
@@ -330,6 +331,7 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
SrsPithyPrint
pithy_print
(
SRS_STAGE_PUBLISH_USER
);
SrsHLS
*
hls
=
source
->
get_hls
();
while
(
true
)
{
// switch to other st-threads.
st_usleep
(
0
);
...
...
trunk/src/core/srs_core_hls.cpp
查看文件 @
4f3cdd5
...
...
@@ -23,3 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_hls.hpp>
SrsHLS
::
SrsHLS
()
{
}
SrsHLS
::~
SrsHLS
()
{
}
...
...
trunk/src/core/srs_core_hls.hpp
查看文件 @
4f3cdd5
...
...
@@ -29,4 +29,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
class
SrsHLS
{
public
:
SrsHLS
();
virtual
~
SrsHLS
();
};
#endif
\ No newline at end of file
...
...
trunk/src/core/srs_core_source.cpp
查看文件 @
4f3cdd5
...
...
@@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_autofree.hpp>
#include <srs_core_amf0.hpp>
#include <srs_core_codec.hpp>
#include <srs_core_hls.hpp>
#define CONST_MAX_JITTER_MS 500
#define DEFAULT_FRAME_TIME_MS 10
...
...
@@ -240,6 +241,7 @@ SrsSource::SrsSource(std::string _stream_url)
{
stream_url
=
_stream_url
;
codec
=
new
SrsCodec
();
hls
=
new
SrsHLS
();
cache_metadata
=
cache_sh_video
=
cache_sh_audio
=
NULL
;
...
...
@@ -265,13 +267,20 @@ SrsSource::~SrsSource()
srs_freep
(
cache_sh_audio
);
srs_freep
(
codec
);
srs_freep
(
hls
);
}
SrsHLS
*
SrsSource
::
get_hls
()
{
return
hls
;
}
int
SrsSource
::
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
)
{
int
ret
=
ERROR_SUCCESS
;
metadata
->
metadata
->
set
(
"server"
,
new
SrsAmf0String
(
metadata
->
metadata
->
set
(
"server"
,
new
SrsAmf0String
(
RTMP_SIG_SRS_KEY
));
metadata
->
metadata
->
set
(
"srs_server"
,
new
SrsAmf0String
(
RTMP_SIG_SRS_KEY
" "
RTMP_SIG_SRS_VERSION
" ("
RTMP_SIG_SRS_URL_SHORT
")"
));
SrsAmf0Any
*
prop
=
NULL
;
...
...
@@ -418,6 +427,19 @@ int SrsSource::on_video(SrsCommonMessage* video)
return
ret
;
}
void
SrsSource
::
on_unpublish
()
{
clear_gop_cache
();
srs_freep
(
cache_metadata
);
video_frame_rate
=
audio_sample_rate
=
0
;
srs_freep
(
cache_sh_video
);
srs_freep
(
cache_sh_audio
);
srs_trace
(
"clear cache/metadata/sequence-headers when unpublish."
);
}
int
SrsSource
::
create_consumer
(
SrsConsumer
*&
consumer
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -466,19 +488,6 @@ void SrsSource::on_consumer_destroy(SrsConsumer* consumer)
srs_info
(
"handle consumer destroy success."
);
}
void
SrsSource
::
on_unpublish
()
{
clear_gop_cache
();
srs_freep
(
cache_metadata
);
video_frame_rate
=
audio_sample_rate
=
0
;
srs_freep
(
cache_sh_video
);
srs_freep
(
cache_sh_audio
);
srs_trace
(
"clear cache/metadata/sequence-headers when unpublish."
);
}
void
SrsSource
::
set_cache
(
bool
enabled
)
{
enable_gop_cache
=
enabled
;
...
...
trunk/src/core/srs_core_source.hpp
查看文件 @
4f3cdd5
...
...
@@ -39,6 +39,7 @@ class SrsSource;
class
SrsCommonMessage
;
class
SrsOnMetaDataPacket
;
class
SrsSharedPtrMessage
;
class
SrsHLS
;
/**
* the consumer for SrsSource, that is a play client.
...
...
@@ -106,6 +107,7 @@ public:
*/
static
SrsSource
*
find
(
std
::
string
stream_url
);
private
:
SrsHLS
*
hls
;
SrsCodec
*
codec
;
std
::
string
stream_url
;
std
::
vector
<
SrsConsumer
*>
consumers
;
...
...
@@ -144,13 +146,19 @@ public:
SrsSource
(
std
::
string
_stream_url
);
virtual
~
SrsSource
();
public
:
/**
* get the hls handler, which has a long lifecycle
* util the source destroyed.
*/
virtual
SrsHLS
*
get_hls
();
public
:
virtual
int
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
);
virtual
int
on_audio
(
SrsCommonMessage
*
audio
);
virtual
int
on_video
(
SrsCommonMessage
*
video
);
virtual
void
on_unpublish
();
public
:
virtual
int
create_consumer
(
SrsConsumer
*&
consumer
);
virtual
void
on_consumer_destroy
(
SrsConsumer
*
consumer
);
virtual
void
on_unpublish
();
virtual
void
set_cache
(
bool
enabled
);
private
:
/**
...
...
请
注册
或
登录
后发表评论