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-20 10:08:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d1e20dc8660af3a0f45d0c5949b515eab31679a2
d1e20dc8
1 parent
c7937241
fix the global static instance error, use function to get server
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
28 行增加
和
14 行删除
trunk/research/ts_info.cpp
trunk/src/core/srs_core_server.cpp
trunk/src/core/srs_core_server.hpp
trunk/src/main/srs_main_server.cpp
trunk/research/ts_info.cpp
查看文件 @
d1e20dc
...
...
@@ -81,6 +81,8 @@ Annex A C CRC Decoder Model
// Table 2-29 – Stream type assignments. page 66.
enum
TSStreamType
{
// ITU-T | ISO/IEC Reserved
TSStreamTypeReserved
=
0x00
,
/*defined by ffmpeg*/
TSStreamTypeVideoMpeg1
=
0x01
,
TSStreamTypeVideoMpeg2
=
0x02
,
...
...
@@ -508,8 +510,12 @@ public:
int
demux
(
TSContext
*
ctx
,
TSPacket
*
pkt
,
u_int8_t
*
start
,
u_int8_t
*
last
,
u_int8_t
*&
p
,
TSMessage
*&
pmsg
);
};
/**
* logic ts pid.
*/
struct
TSPid
{
TSStreamType
stream_type
;
TSPidType
type
;
int16_t
pid
;
};
...
...
@@ -526,6 +532,8 @@ public:
// the type of pid.
TSPidType
type
;
// the type of stream, codec type.
TSStreamType
stream_type
;
// 2.4.3.7 Semantic definition of fields in PES packet. page 49
// PES packet header size plus data size.
...
...
@@ -571,7 +579,7 @@ public:
virtual
~
TSContext
();
bool
exists
(
int16_t
pid
);
TSPid
*
get
(
int16_t
pid
);
void
push
(
TSPidType
type
,
int16_t
pid
);
void
push
(
TS
StreamType
stream_type
,
TS
PidType
type
,
int16_t
pid
);
TSMessage
*
get_msg
(
int16_t
pid
);
void
detach
(
TSMessage
*
msg
);
...
...
@@ -617,7 +625,7 @@ TSPid* TSContext::get(int16_t pid)
return
NULL
;
}
void
TSContext
::
push
(
TSPidType
type
,
int16_t
pid
)
void
TSContext
::
push
(
TS
StreamType
stream_type
,
TS
PidType
type
,
int16_t
pid
)
{
if
(
exists
(
pid
))
{
return
;
...
...
@@ -626,7 +634,7 @@ void TSContext::push(TSPidType type, int16_t pid)
TSPid
*
p
=
new
TSPid
[
pid_size
+
1
];
memcpy
(
p
,
pids
,
sizeof
(
TSPid
)
*
pid_size
);
p
[
pid_size
]
=
(
TSPid
){
type
,
pid
};
p
[
pid_size
]
=
(
TSPid
){
stream_type
,
type
,
pid
};
pid_size
++
;
srs_freepa
(
pids
);
...
...
@@ -653,6 +661,7 @@ TSMessage::TSMessage()
{
pid
=
0
;
type
=
TSPidTypeReserved
;
stream_type
=
TSStreamTypeReserved
;
stream_id
=
0
;
packet_start_code_prefix
=
0
;
PES_packet_length
=
0
;
...
...
@@ -959,7 +968,7 @@ int TSPayloadPAT::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
pp
[
0
]
=
*
p
++
;
int16_t
pid
=
programs
[
i
]
&
0x1FFF
;
ctx
->
push
(
TSPidTypePMT
,
pid
);
ctx
->
push
(
TS
StreamTypeReserved
,
TS
PidTypePMT
,
pid
);
}
}
...
...
@@ -1096,12 +1105,12 @@ int TSPayloadPMT::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
if
(
info
->
stream_type
==
TSStreamTypeVideoH264
)
{
// TODO: support more video type.
ctx
->
push
(
TSPidTypeVideo
,
info
->
elementary_PID
);
ctx
->
push
(
(
TSStreamType
)
info
->
stream_type
,
TSPidTypeVideo
,
info
->
elementary_PID
);
trace
(
"ts+pmt add pid: %d, type: H264 video"
,
info
->
elementary_PID
);
}
else
if
(
info
->
stream_type
==
TSStreamTypeAudioAAC
)
{
// TODO: support more audio type.
// see aac: 6.2 Audio Data Transport Stream, ADTS
ctx
->
push
(
TSPidTypeAudio
,
info
->
elementary_PID
);
ctx
->
push
(
(
TSStreamType
)
info
->
stream_type
,
TSPidTypeAudio
,
info
->
elementary_PID
);
trace
(
"ts+pmt add pid: %d, type: AAC audio"
,
info
->
elementary_PID
);
}
else
{
trace
(
"ts+pmt ignore the stream type: %d"
,
info
->
stream_type
);
...
...
@@ -1406,6 +1415,7 @@ int TSPayloadPES::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
TSMessage
*
msg
=
ctx
->
get_msg
(
pid
->
pid
);
msg
->
type
=
pid
->
type
;
msg
->
stream_type
=
pid
->
stream_type
;
msg
->
stream_id
=
stream_id
;
msg
->
packet_start_code_prefix
=
packet_start_code_prefix
;
...
...
@@ -1615,7 +1625,7 @@ int TSHeader::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* la
transport_priority
=
(
pid
>>
13
)
&
0x01
;
pid
&=
0x1FFF
;
ctx
->
push
(
TSPidTypePAT
,
pid
);
ctx
->
push
(
TS
StreamTypeReserved
,
TS
PidTypePAT
,
pid
);
continuity_counter
=
*
p
++
;
...
...
trunk/src/core/srs_core_server.cpp
查看文件 @
d1e20dc
...
...
@@ -171,6 +171,7 @@ SrsServer::SrsServer()
{
signal_reload
=
false
;
srs_assert
(
config
);
config
->
subscribe
(
this
);
}
...
...
@@ -328,5 +329,8 @@ int SrsServer::on_reload_listen()
return
listen
();
}
SrsServer
server
;
SrsServer
*
_server
()
{
static
SrsServer
server
;
return
&
server
;
}
...
...
trunk/src/core/srs_core_server.hpp
查看文件 @
d1e20dc
...
...
@@ -89,6 +89,6 @@ public:
virtual
int
on_reload_listen
();
};
extern
SrsServer
server
;
SrsServer
*
_server
()
;
#endif
\ No newline at end of file
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
d1e20dc
...
...
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void
handler
(
int
signo
)
{
srs_trace
(
"get a signal, signo=%d"
,
signo
);
server
.
on_signal
(
signo
);
_server
()
->
on_signal
(
signo
);
}
int
main
(
int
argc
,
char
**
argv
){
...
...
@@ -44,15 +44,15 @@ int main(int argc, char** argv){
return
ret
;
}
if
((
ret
=
server
.
initialize
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_server
()
->
initialize
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
server
.
listen
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_server
()
->
listen
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
server
.
cycle
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_server
()
->
cycle
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
请
注册
或
登录
后发表评论