Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
fc570408
Commit
fc570408
authored
Jun 03, 2015
by
Ghislain MARY
Browse files
Add discontinuity check in rfc3984 unpacker.
parent
c944c0b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
include/mediastreamer2/rfc3984.h
include/mediastreamer2/rfc3984.h
+7
-3
src/voip/rfc3984.c
src/voip/rfc3984.c
+18
-1
No files found.
include/mediastreamer2/rfc3984.h
View file @
fc570408
...
@@ -37,9 +37,10 @@ typedef struct Rfc3984Context{
...
@@ -37,9 +37,10 @@ typedef struct Rfc3984Context{
mblk_t
*
m
;
mblk_t
*
m
;
int
maxsz
;
int
maxsz
;
uint32_t
last_ts
;
uint32_t
last_ts
;
uint16_t
ref_cseq
;
uint8_t
mode
;
uint8_t
mode
;
bool_t
stap_a_allowed
;
bool_t
stap_a_allowed
;
uint8_t
reserved
;
bool_t
initialized_ref_cseq
;
}
Rfc3984Context
;
}
Rfc3984Context
;
MS2_PUBLIC
Rfc3984Context
*
rfc3984_new
(
void
);
MS2_PUBLIC
Rfc3984Context
*
rfc3984_new
(
void
);
...
@@ -55,8 +56,11 @@ MS2_PUBLIC void rfc3984_enable_stap_a(Rfc3984Context *ctx, bool_t yesno);
...
@@ -55,8 +56,11 @@ MS2_PUBLIC void rfc3984_enable_stap_a(Rfc3984Context *ctx, bool_t yesno);
/*process NALUs and pack them into rtp payloads */
/*process NALUs and pack them into rtp payloads */
MS2_PUBLIC
void
rfc3984_pack
(
Rfc3984Context
*
ctx
,
MSQueue
*
naluq
,
MSQueue
*
rtpq
,
uint32_t
ts
);
MS2_PUBLIC
void
rfc3984_pack
(
Rfc3984Context
*
ctx
,
MSQueue
*
naluq
,
MSQueue
*
rtpq
,
uint32_t
ts
);
/*process incoming rtp data and output NALUs, whenever possible*/
/**
MS2_PUBLIC
void
rfc3984_unpack
(
Rfc3984Context
*
ctx
,
mblk_t
*
im
,
MSQueue
*
naluq
);
* Process incoming rtp data and output NALUs, whenever possible.
* @return 0 if everything was ok, -1 on error.
**/
MS2_PUBLIC
int
rfc3984_unpack
(
Rfc3984Context
*
ctx
,
mblk_t
*
im
,
MSQueue
*
naluq
);
void
rfc3984_uninit
(
Rfc3984Context
*
ctx
);
void
rfc3984_uninit
(
Rfc3984Context
*
ctx
);
...
...
src/voip/rfc3984.c
View file @
fc570408
...
@@ -243,11 +243,13 @@ static mblk_t * aggregate_fua(Rfc3984Context *ctx, mblk_t *im){
...
@@ -243,11 +243,13 @@ static mblk_t * aggregate_fua(Rfc3984Context *ctx, mblk_t *im){
}
}
/*process incoming rtp data and output NALUs, whenever possible*/
/*process incoming rtp data and output NALUs, whenever possible*/
void
rfc3984_unpack
(
Rfc3984Context
*
ctx
,
mblk_t
*
im
,
MSQueue
*
out
){
int
rfc3984_unpack
(
Rfc3984Context
*
ctx
,
mblk_t
*
im
,
MSQueue
*
out
){
uint8_t
type
=
nal_header_get_type
(
im
->
b_rptr
);
uint8_t
type
=
nal_header_get_type
(
im
->
b_rptr
);
uint8_t
*
p
;
uint8_t
*
p
;
int
marker
=
mblk_get_marker_info
(
im
);
int
marker
=
mblk_get_marker_info
(
im
);
uint32_t
ts
=
mblk_get_timestamp_info
(
im
);
uint32_t
ts
=
mblk_get_timestamp_info
(
im
);
uint16_t
cseq
=
mblk_get_cseq
(
im
);
int
res
=
0
;
if
(
ctx
->
last_ts
!=
ts
){
if
(
ctx
->
last_ts
!=
ts
){
/*a new frame is arriving, in case the marker bit was not set in previous frame, output it now*/
/*a new frame is arriving, in case the marker bit was not set in previous frame, output it now*/
...
@@ -258,6 +260,7 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
...
@@ -258,6 +260,7 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
while
(
!
ms_queue_empty
(
&
ctx
->
q
)){
while
(
!
ms_queue_empty
(
&
ctx
->
q
)){
ms_queue_put
(
out
,
ms_queue_get
(
&
ctx
->
q
));
ms_queue_put
(
out
,
ms_queue_get
(
&
ctx
->
q
));
out_without_marker
=
TRUE
;
out_without_marker
=
TRUE
;
res
=
-
1
;
}
}
if
(
out_without_marker
)
ms_warning
(
"Incomplete H264 frame (missing marker bit)"
);
if
(
out_without_marker
)
ms_warning
(
"Incomplete H264 frame (missing marker bit)"
);
}
}
...
@@ -265,6 +268,18 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
...
@@ -265,6 +268,18 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
if
(
im
->
b_cont
)
msgpullup
(
im
,
-
1
);
if
(
im
->
b_cont
)
msgpullup
(
im
,
-
1
);
if
(
!
ctx
->
initialized_ref_cseq
)
{
ctx
->
initialized_ref_cseq
=
TRUE
;
ctx
->
ref_cseq
=
cseq
;
}
else
{
ctx
->
ref_cseq
++
;
if
(
ctx
->
ref_cseq
!=
cseq
)
{
ms_message
(
"sequence inconsistency detected (diff=%i)"
,(
int
)(
cseq
-
ctx
->
ref_cseq
));
ctx
->
ref_cseq
=
cseq
;
res
=
-
1
;
}
}
if
(
type
==
TYPE_STAP_A
){
if
(
type
==
TYPE_STAP_A
){
/*split into nalus*/
/*split into nalus*/
uint16_t
sz
;
uint16_t
sz
;
...
@@ -312,6 +327,8 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
...
@@ -312,6 +327,8 @@ void rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *out){
ms_queue_put
(
out
,
ms_queue_get
(
&
ctx
->
q
));
ms_queue_put
(
out
,
ms_queue_get
(
&
ctx
->
q
));
}
}
}
}
return
res
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment