mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-21 02:34:16 +00:00
FS-7519: increase default video buffer to 2mb in avformat and add vbuf file param to change it per file using a number of bytes with k or m modifier for kilobytes and megabytes
This commit is contained in:
1 parent
cbe4f10ba3
commit
dd3d6cbe76
3 files changed
+28
-1
No files matched your search
@@ -177,6 +177,8 @@ static switch_status_t add_stream(OutputStream *ost, AVFormatContext *oc, AVCode
|
||||
AVCodecContext *c;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
int threads = switch_core_cpu_count();
|
||||
int buffer_bytes = 2097152; /* 2 mb */
|
||||
|
||||
/* find the encoder */
|
||||
*codec = avcodec_find_encoder(codec_id);
|
||||
if (!(*codec)) {
|
||||
@@ -217,6 +219,13 @@ static switch_status_t add_stream(OutputStream *ost, AVFormatContext *oc, AVCode
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
|
||||
if (mm) {
|
||||
if (mm->vbuf) {
|
||||
buffer_bytes = mm->vbuf;
|
||||
}
|
||||
}
|
||||
|
||||
c->codec_id = codec_id;
|
||||
c->bit_rate = 1000000;
|
||||
/* Resolution must be a multiple of two. */
|
||||
@@ -227,7 +236,8 @@ static switch_status_t add_stream(OutputStream *ost, AVFormatContext *oc, AVCode
|
||||
c->gop_size = 25; /* emit one intra frame every x frames at most */
|
||||
c->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
c->thread_count = threads;
|
||||
c->rc_initial_buffer_occupancy = 1024 * 1024 * 8;
|
||||
c->rc_initial_buffer_occupancy = buffer_bytes * 8;
|
||||
|
||||
if (codec_id == AV_CODEC_ID_VP8) {
|
||||
av_set_options_string(c, "quality=realtime", "=", ":");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user