Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
37d31306
Commit
37d31306
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
sipvoiplink: more string_view
Change-Id: I2022b0e6d19771848f62c46305b2504e2568b2dd
parent
e843d60a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sip/sipvoiplink.cpp
+9
-12
9 additions, 12 deletions
src/sip/sipvoiplink.cpp
src/string_utils.h
+8
-0
8 additions, 0 deletions
src/string_utils.h
with
17 additions
and
12 deletions
src/sip/sipvoiplink.cpp
+
9
−
12
View file @
37d31306
...
...
@@ -1060,22 +1060,20 @@ handleMediaControl(SIPCall& call, pjsip_msg_body* body)
if
(
body
->
len
and
pj_stricmp
(
&
body
->
content_type
.
type
,
&
STR_APPLICATION
)
==
0
and
pj_stricmp
(
&
body
->
content_type
.
subtype
,
&
STR_MEDIA_CONTROL_XML
)
==
0
)
{
pj_str_t
control_st
;
auto
body_msg
=
std
::
string_view
((
char
*
)
body
->
data
,
(
size_t
)
body
->
len
)
;
/* Apply and answer the INFO request */
pj_strset
(
&
control_st
,
(
char
*
)
body
->
data
,
body
->
len
);
static
constexpr
pj_str_t
PICT_FAST_UPDATE
=
CONST_PJ_STR
(
"picture_fast_update"
);
static
constexpr
pj_str_t
DEVICE_ORIENTATION
=
CONST_PJ_STR
(
"device_orientation"
);
static
constexpr
pj_str_t
RECORDING_STATE
=
CONST_PJ_STR
(
"recording_state"
);
static
constexpr
auto
PICT_FAST_UPDATE
=
"picture_fast_update"
sv
;
static
constexpr
auto
DEVICE_ORIENTATION
=
"device_orientation"
sv
;
static
constexpr
auto
RECORDING_STATE
=
"recording_state"
sv
;
if
(
pj_strstr
(
&
control_st
,
&
PICT_FAST_UPDATE
)
)
{
if
(
body_msg
.
find
(
PICT_FAST_UPDATE
)
!=
std
::
string_view
::
npos
)
{
call
.
sendKeyframe
();
return
true
;
}
else
if
(
pj_strstr
(
&
control_st
,
&
DEVICE_ORIENTATION
)
)
{
}
else
if
(
body_msg
.
find
(
DEVICE_ORIENTATION
)
!=
std
::
string_view
::
npos
)
{
static
const
std
::
regex
ORIENTATION_REGEX
(
"device_orientation=([-+]?[0-9]+)"
);
std
::
string
body_msg
(
control_st
.
ptr
,
control_st
.
slen
);
std
::
smatch
matched_pattern
;
std
::
svmatch
matched_pattern
;
std
::
regex_search
(
body_msg
,
matched_pattern
,
ORIENTATION_REGEX
);
if
(
matched_pattern
.
ready
()
&&
!
matched_pattern
.
empty
()
&&
matched_pattern
[
1
].
matched
)
{
...
...
@@ -1094,10 +1092,9 @@ handleMediaControl(SIPCall& call, pjsip_msg_body* body)
}
return
true
;
}
}
else
if
(
pj_strstr
(
&
control_st
,
&
RECORDING_STATE
)
)
{
}
else
if
(
body_msg
.
find
(
RECORDING_STATE
)
!=
std
::
string_view
::
npos
)
{
static
const
std
::
regex
REC_REGEX
(
"recording_state=([0-1])"
);
std
::
string
body_msg
(
control_st
.
ptr
,
control_st
.
slen
);
std
::
smatch
matched_pattern
;
std
::
svmatch
matched_pattern
;
std
::
regex_search
(
body_msg
,
matched_pattern
,
REC_REGEX
);
if
(
matched_pattern
.
ready
()
&&
!
matched_pattern
.
empty
()
&&
matched_pattern
[
1
].
matched
)
{
...
...
This diff is collapsed.
Click to expand it.
src/string_utils.h
+
8
−
0
View file @
37d31306
...
...
@@ -68,6 +68,14 @@ regex_match(string_view sv,
{
return
regex_match
(
sv
.
begin
(),
sv
.
end
(),
e
,
flags
);
}
inline
bool
regex_search
(
string_view
sv
,
svmatch
&
m
,
const
regex
&
e
,
regex_constants
::
match_flag_type
flags
=
regex_constants
::
match_default
)
{
return
regex_search
(
sv
.
begin
(),
sv
.
end
(),
m
,
e
,
flags
);
}
}
// namespace std
namespace
jami
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment