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
a77698c8
Commit
a77698c8
authored
Oct 02, 2013
by
Ghislain MARY
Browse files
Do not change video size when changing the bitrate while already encoding video.
parent
ff24a844
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
16 deletions
+13
-16
src/videofilters/videoenc.c
src/videofilters/videoenc.c
+6
-13
src/videofilters/vp8.c
src/videofilters/vp8.c
+7
-3
No files found.
src/videofilters/videoenc.c
View file @
a77698c8
...
...
@@ -937,20 +937,13 @@ static int enc_get_br(MSFilter *f, void *arg){
static
int
enc_set_br
(
MSFilter
*
f
,
void
*
arg
)
{
EncState
*
s
=
(
EncState
*
)
f
->
data
;
int
br
=
*
(
int
*
)
arg
;
const
MSVideoConfiguration
*
current_vconf
=
get_vconf_list
(
s
);
const
MSVideoConfiguration
*
closer_to_best_vconf
=
NULL
;
MSVideoConfiguration
best_vconf
;
while
(
closer_to_best_vconf
==
NULL
)
{
if
((
br
>=
current_vconf
->
required_bitrate
)
||
(
current_vconf
->
required_bitrate
==
0
))
{
closer_to_best_vconf
=
current_vconf
;
}
else
{
current_vconf
++
;
}
if
(
s
->
av_context
.
codec
!=
NULL
)
{
/* Encoding is already ongoing, do not change video size, only bitrate. */
s
->
vconf
.
required_bitrate
=
br
;
}
else
{
MSVideoConfiguration
best_vconf
=
ms_video_find_best_configuration_for_bitrate
(
s
->
vconf_list
,
br
);
enc_set_configuration
(
f
,
&
best_vconf
);
}
memcpy
(
&
best_vconf
,
closer_to_best_vconf
,
sizeof
(
best_vconf
));
best_vconf
.
required_bitrate
=
br
;
enc_set_configuration
(
f
,
&
best_vconf
);
return
0
;
}
...
...
src/videofilters/vp8.c
View file @
a77698c8
...
...
@@ -342,11 +342,15 @@ static int enc_get_br(MSFilter *f, void*data){
}
static
int
enc_set_br
(
MSFilter
*
f
,
void
*
data
)
{
MSVideoConfiguration
best_vconf
;
EncState
*
s
=
(
EncState
*
)
f
->
data
;
int
br
=
*
(
int
*
)
data
;
best_vconf
=
ms_video_find_best_configuration_for_bitrate
(
s
->
vconf_list
,
br
);
enc_set_configuration
(
f
,
&
best_vconf
);
if
(
s
->
ready
)
{
/* Encoding is already ongoing, do not change video size, only bitrate. */
s
->
vconf
.
required_bitrate
=
br
;
}
else
{
MSVideoConfiguration
best_vconf
=
ms_video_find_best_configuration_for_bitrate
(
s
->
vconf_list
,
br
);
enc_set_configuration
(
f
,
&
best_vconf
);
}
return
0
;
}
...
...
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