Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
9c0aaf06
Commit
9c0aaf06
authored
9 years ago
by
Matt Jordan
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_format_attr_vp8: In SDP, forward max-fr and max-fs for video-codec VP8." into 13
parents
ffb06434
5a18193d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES
+5
-0
5 additions, 0 deletions
CHANGES
res/res_format_attr_vp8.c
+228
-0
228 additions, 0 deletions
res/res_format_attr_vp8.c
with
233 additions
and
0 deletions
CHANGES
+
5
−
0
View file @
9c0aaf06
...
@@ -20,6 +20,11 @@ bridge_t38
...
@@ -20,6 +20,11 @@ bridge_t38
several esoteric issues that can occur when channels are removed from a
several esoteric issues that can occur when channels are removed from a
bridge after completing a T.38 fax.
bridge after completing a T.38 fax.
Codecs
------------------
* Added format attribute negotiation for the VP8 video codec. Format attribute
negotiation is provided by the res_format_attr_vp8 module.
ConfBridge
ConfBridge
------------------
------------------
* A new "timeout" user profile option has been added. This configures the number
* A new "timeout" user profile option has been added. This configures the number
...
...
This diff is collapsed.
Click to expand it.
res/res_format_attr_vp8.c
0 → 100644
+
228
−
0
View file @
9c0aaf06
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2015, Alexander Traud
*
* Alexander Traud <pabstraud@compuserve.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*!
* \file
* \brief VP8 format attribute interface
*
* \author Alexander Traud <pabstraud@compuserve.com>
*
* \note http://tools.ietf.org/html/draft-ietf-payload-vp8
*/
/*** MODULEINFO
<support_level>core</support_level>
***/
#include
"asterisk.h"
ASTERISK_FILE_VERSION
(
__FILE__
,
"$Revision$"
)
#include
"asterisk/module.h"
#include
"asterisk/format.h"
#include
"asterisk/logger.h"
/* for ast_log, LOG_WARNING */
#include
"asterisk/strings.h"
/* for ast_str_append */
#include
"asterisk/utils.h"
/* for MIN, ast_malloc, ast_free */
struct
vp8_attr
{
unsigned
int
maximum_frame_rate
;
unsigned
int
maximum_frame_size
;
};
static
struct
vp8_attr
default_vp8_attr
=
{
.
maximum_frame_rate
=
UINT_MAX
,
.
maximum_frame_size
=
UINT_MAX
,
};
static
void
vp8_destroy
(
struct
ast_format
*
format
)
{
struct
vp8_attr
*
attr
=
ast_format_get_attribute_data
(
format
);
ast_free
(
attr
);
}
static
int
vp8_clone
(
const
struct
ast_format
*
src
,
struct
ast_format
*
dst
)
{
struct
vp8_attr
*
original
=
ast_format_get_attribute_data
(
src
);
struct
vp8_attr
*
attr
=
ast_malloc
(
sizeof
(
*
attr
));
if
(
!
attr
)
{
return
-
1
;
}
if
(
original
)
{
*
attr
=
*
original
;
}
else
{
*
attr
=
default_vp8_attr
;
}
ast_format_set_attribute_data
(
dst
,
attr
);
return
0
;
}
static
struct
ast_format
*
vp8_parse_sdp_fmtp
(
const
struct
ast_format
*
format
,
const
char
*
attributes
)
{
struct
ast_format
*
cloned
;
struct
vp8_attr
*
attr
;
const
char
*
kvp
;
unsigned
int
val
;
cloned
=
ast_format_clone
(
format
);
if
(
!
cloned
)
{
return
NULL
;
}
attr
=
ast_format_get_attribute_data
(
cloned
);
if
((
kvp
=
strstr
(
attributes
,
"max-fr"
))
&&
sscanf
(
kvp
,
"max-fr=%30u"
,
&
val
)
==
1
)
{
attr
->
maximum_frame_rate
=
val
;
}
else
{
attr
->
maximum_frame_rate
=
UINT_MAX
;
}
if
((
kvp
=
strstr
(
attributes
,
"max-fs"
))
&&
sscanf
(
kvp
,
"max-fs=%30u"
,
&
val
)
==
1
)
{
attr
->
maximum_frame_size
=
val
;
}
else
{
attr
->
maximum_frame_size
=
UINT_MAX
;
}
return
cloned
;
}
static
void
vp8_generate_sdp_fmtp
(
const
struct
ast_format
*
format
,
unsigned
int
payload
,
struct
ast_str
**
str
)
{
struct
vp8_attr
*
attr
=
ast_format_get_attribute_data
(
format
);
int
added
=
0
;
if
(
!
attr
)
{
/*
* (Only) cached formats do not have attribute data assigned because
* they were created before this attribute module was registered.
* Therefore, we assume the default attribute values here.
*/
attr
=
&
default_vp8_attr
;
}
if
(
UINT_MAX
!=
attr
->
maximum_frame_rate
)
{
if
(
added
)
{
ast_str_append
(
str
,
0
,
";"
);
}
else
if
(
0
<
ast_str_append
(
str
,
0
,
"a=fmtp:%u "
,
payload
))
{
added
=
1
;
}
ast_str_append
(
str
,
0
,
"max-fr=%u"
,
attr
->
maximum_frame_rate
);
}
if
(
UINT_MAX
!=
attr
->
maximum_frame_size
)
{
if
(
added
)
{
ast_str_append
(
str
,
0
,
";"
);
}
else
if
(
0
<
ast_str_append
(
str
,
0
,
"a=fmtp:%u "
,
payload
))
{
added
=
1
;
}
ast_str_append
(
str
,
0
,
"max-fs=%u"
,
attr
->
maximum_frame_size
);
}
if
(
added
)
{
ast_str_append
(
str
,
0
,
"
\r\n
"
);
}
}
static
struct
ast_format
*
vp8_getjoint
(
const
struct
ast_format
*
format1
,
const
struct
ast_format
*
format2
)
{
struct
vp8_attr
*
attr1
=
ast_format_get_attribute_data
(
format1
);
struct
vp8_attr
*
attr2
=
ast_format_get_attribute_data
(
format2
);
struct
ast_format
*
jointformat
;
struct
vp8_attr
*
attr_res
;
if
(
!
attr1
)
{
attr1
=
&
default_vp8_attr
;
}
if
(
!
attr2
)
{
attr2
=
&
default_vp8_attr
;
}
jointformat
=
ast_format_clone
(
format1
);
if
(
!
jointformat
)
{
return
NULL
;
}
attr_res
=
ast_format_get_attribute_data
(
jointformat
);
attr_res
->
maximum_frame_rate
=
MIN
(
attr1
->
maximum_frame_rate
,
attr2
->
maximum_frame_rate
);
attr_res
->
maximum_frame_size
=
MIN
(
attr1
->
maximum_frame_size
,
attr2
->
maximum_frame_size
);
return
jointformat
;
}
static
struct
ast_format
*
vp8_set
(
const
struct
ast_format
*
format
,
const
char
*
name
,
const
char
*
value
)
{
struct
ast_format
*
cloned
;
struct
vp8_attr
*
attr
;
unsigned
int
val
;
if
(
sscanf
(
value
,
"%30u"
,
&
val
)
!=
1
)
{
ast_log
(
LOG_WARNING
,
"Unknown value '%s' for attribute type '%s'
\n
"
,
value
,
name
);
return
NULL
;
}
cloned
=
ast_format_clone
(
format
);
if
(
!
cloned
)
{
return
NULL
;
}
attr
=
ast_format_get_attribute_data
(
cloned
);
if
(
!
strcasecmp
(
name
,
"maximum_frame_rate"
))
{
attr
->
maximum_frame_rate
=
val
;
}
else
if
(
!
strcasecmp
(
name
,
"maximum_frame_size"
))
{
attr
->
maximum_frame_size
=
val
;
}
else
{
ast_log
(
LOG_WARNING
,
"unknown attribute type %s
\n
"
,
name
);
}
return
cloned
;
}
static
struct
ast_format_interface
vp8_interface
=
{
.
format_destroy
=
vp8_destroy
,
.
format_clone
=
vp8_clone
,
.
format_get_joint
=
vp8_getjoint
,
.
format_attribute_set
=
vp8_set
,
.
format_parse_sdp_fmtp
=
vp8_parse_sdp_fmtp
,
.
format_generate_sdp_fmtp
=
vp8_generate_sdp_fmtp
,
};
static
int
load_module
(
void
)
{
if
(
ast_format_interface_register
(
"vp8"
,
&
vp8_interface
))
{
return
AST_MODULE_LOAD_DECLINE
;
}
return
AST_MODULE_LOAD_SUCCESS
;
}
static
int
unload_module
(
void
)
{
return
0
;
}
AST_MODULE_INFO
(
ASTERISK_GPL_KEY
,
AST_MODFLAG_LOAD_ORDER
,
"VP8 Format Attribute Module"
,
.
support_level
=
AST_MODULE_SUPPORT_CORE
,
.
load
=
load_module
,
.
unload
=
unload_module
,
.
load_pri
=
AST_MODPRI_CHANNEL_DEPEND
,
);
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