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
5eec4ea5
Commit
5eec4ea5
authored
Nov 30, 2016
by
François Grisez
Browse files
Rfc3984unpacker: introduce a new status flag to be set when SPS or PPS has changed
parent
d1575ffb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
include/mediastreamer2/rfc3984.h
include/mediastreamer2/rfc3984.h
+3
-1
src/voip/rfc3984.c
src/voip/rfc3984.c
+30
-4
No files found.
include/mediastreamer2/rfc3984.h
View file @
5eec4ea5
...
...
@@ -35,7 +35,8 @@ extern "C"{
typedef
enum
{
Rfc3984FrameAvailable
=
1
,
Rfc3984FrameCorrupted
=
1
<<
1
,
Rfc3984IsKeyFrame
=
1
<<
2
Rfc3984IsKeyFrame
=
1
<<
2
,
Rfc3984NewParameterSet
=
1
<<
3
}
Rfc3984Status
;
typedef
struct
Rfc3984Context
{
...
...
@@ -44,6 +45,7 @@ typedef struct Rfc3984Context{
int
maxsz
;
unsigned
int
status
;
/*bitmask of Rfc3984Status values*/
mblk_t
*
sps
,
*
pps
;
mblk_t
*
last_sps
,
*
last_pps
;
uint32_t
last_ts
;
uint16_t
ref_cseq
;
uint8_t
mode
;
...
...
src/voip/rfc3984.c
View file @
5eec4ea5
...
...
@@ -287,6 +287,23 @@ static unsigned int output_frame(Rfc3984Context * ctx, MSQueue *out, unsigned in
return
res
;
}
static
bool_t
update_parameter_set
(
mblk_t
**
last_parameter_set
,
mblk_t
*
new_parameter_set
)
{
if
(
*
last_parameter_set
!=
NULL
)
{
size_t
last_size
=
(
*
last_parameter_set
)
->
b_wptr
-
(
*
last_parameter_set
)
->
b_rptr
;
size_t
new_size
=
new_parameter_set
->
b_wptr
-
new_parameter_set
->
b_rptr
;
if
(
last_size
!=
new_size
||
memcmp
(
*
last_parameter_set
,
new_parameter_set
,
new_size
)
==
0
)
{
freemsg
(
*
last_parameter_set
);
*
last_parameter_set
=
dupmsg
(
new_parameter_set
);
return
TRUE
;
}
else
{
return
FALSE
;
}
}
else
{
*
last_parameter_set
=
dupmsg
(
new_parameter_set
);
return
TRUE
;
}
}
static
void
store_nal
(
Rfc3984Context
*
ctx
,
mblk_t
*
nal
){
uint8_t
type
=
nal_header_get_type
(
nal
->
b_rptr
);
if
(
ms_queue_empty
(
&
ctx
->
q
)
&&
(
ctx
->
status
&
Rfc3984FrameCorrupted
)
...
...
@@ -295,11 +312,16 @@ static void store_nal(Rfc3984Context *ctx, mblk_t *nal){
ctx
->
status
&=
~
Rfc3984FrameCorrupted
;
ctx
->
status
|=
Rfc3984IsKeyFrame
;
}
ms_queue_put
(
&
ctx
->
q
,
nal
);
if
(
type
==
MSH264NaluTypeIDR
){
ctx
->
status
|=
Rfc3984IsKeyFrame
;
}
if
(
type
==
MSH264NaluTypeSPS
&&
update_parameter_set
(
&
ctx
->
last_sps
,
nal
))
{
ctx
->
status
|=
Rfc3984NewParameterSet
;
}
if
(
type
==
MSH264NaluTypePPS
&&
update_parameter_set
(
&
ctx
->
last_pps
,
nal
))
{
ctx
->
status
|=
Rfc3984NewParameterSet
;
}
ms_queue_put
(
&
ctx
->
q
,
nal
);
}
unsigned
int
rfc3984_unpack2
(
Rfc3984Context
*
ctx
,
mblk_t
*
im
,
MSQueue
*
out
){
...
...
@@ -398,8 +420,12 @@ void rfc3984_pack(Rfc3984Context *ctx, MSQueue *naluq, MSQueue *rtpq, uint32_t t
void
rfc3984_uninit
(
Rfc3984Context
*
ctx
){
ms_queue_flush
(
&
ctx
->
q
);
if
(
ctx
->
m
)
freemsg
(
ctx
->
m
);
ctx
->
m
=
NULL
;
if
(
ctx
->
m
!=
NULL
)
freemsg
(
ctx
->
m
);
if
(
ctx
->
sps
!=
NULL
)
freemsg
(
ctx
->
sps
);
if
(
ctx
->
pps
!=
NULL
)
freemsg
(
ctx
->
pps
);
ctx
->
m
=
NULL
;
ctx
->
sps
=
NULL
;
ctx
->
pps
=
NULL
;
}
void
rfc3984_set_mode
(
Rfc3984Context
*
ctx
,
int
mode
){
...
...
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