mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-28 06:04:20 +00:00
FS-7500 FS-7513: add video bandwidth control function and use it in mod_conference
This commit is contained in:
1 parent
8be96b106e
commit
fcf32fd53d
7 files changed
+106
-11
No files matched your search
@@ -76,6 +76,7 @@ struct vpx_context {
|
||||
switch_size_t last_received_timestamp;
|
||||
switch_bool_t last_received_complete_picture;
|
||||
int need_key_frame;
|
||||
int32_t change_bandwidth;
|
||||
uint64_t framecount;
|
||||
uint64_t framesum;
|
||||
};
|
||||
@@ -97,6 +98,10 @@ static switch_status_t init_codec(switch_codec_t *codec)
|
||||
context->codec_settings.video.height = 720;
|
||||
}
|
||||
|
||||
if (context->codec_settings.video.bandwidth == -1) {
|
||||
context->codec_settings.video.bandwidth = 0;
|
||||
}
|
||||
|
||||
if (context->codec_settings.video.bandwidth) {
|
||||
context->bandwidth = context->codec_settings.video.bandwidth;
|
||||
} else {
|
||||
@@ -409,6 +414,13 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
|
||||
init_codec(codec);
|
||||
}
|
||||
|
||||
if (context->change_bandwidth) {
|
||||
context->codec_settings.video.bandwidth = context->change_bandwidth;
|
||||
context->change_bandwidth = 0;
|
||||
init_codec(codec);
|
||||
}
|
||||
|
||||
|
||||
if (context->need_key_frame != 0) {
|
||||
// force generate a key frame
|
||||
switch_time_t now = switch_micro_time_now();
|
||||
@@ -634,6 +646,23 @@ static switch_status_t switch_vpx_control(switch_codec_t *codec,
|
||||
case SCC_VIDEO_REFRESH:
|
||||
context->need_key_frame = 1;
|
||||
break;
|
||||
case SCC_VIDEO_BANDWIDTH:
|
||||
{
|
||||
switch(ctype) {
|
||||
case SCCT_INT:
|
||||
context->change_bandwidth = *((int *) cmd_data);
|
||||
break;
|
||||
case SCCT_STRING:
|
||||
{
|
||||
char *bwv = (char *) cmd_data;
|
||||
context->change_bandwidth = switch_parse_bandwidth_string(bwv);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user