Browse Source

MT#62544 add output-buffer option

Change-Id: Id823046b52ed7ebc8d19cc1d2d7b28eff0e0b6e0
pull/1945/head
Richard Fuchs 7 months ago
parent
commit
02253c6f05
5 changed files with 29 additions and 0 deletions
  1. +5
    -0
      docs/rtpengine-recording.md
  2. +5
    -0
      recording-daemon/main.c
  3. +1
    -0
      recording-daemon/main.h
  4. +17
    -0
      recording-daemon/output.c
  5. +1
    -0
      recording-daemon/types.h

+ 5
- 0
docs/rtpengine-recording.md View File

@ -293,6 +293,11 @@ sufficient for a standard installation of rtpengine.
are supported. If the value is blank or given as __-1__ then the user/group is
left unchanged.
- __\-\-output-buffer=__*INT*
Set the size of the I/O buffer used for writing files. The default is 2^18
bytes (256 kB). Can be set to zero to effect unbuffered I/O.
- __\-\-mysql-host=__*HOST*\|*IP*
- __\-\-mysql-port=__*INT*
- __\-\-mysql-user=__*USERNAME*


+ 5
- 0
recording-daemon/main.c View File

@ -49,6 +49,7 @@ mode_t output_chmod_dir;
uid_t output_chown = -1;
gid_t output_chgrp = -1;
char *output_pattern = NULL;
int output_buffer = 1<<18;
gboolean decoding_enabled;
char *c_mysql_host,
*c_mysql_user,
@ -213,6 +214,7 @@ static void options(int *argc, char ***argv) {
{ "output-chmod-dir", 0, 0, G_OPTION_ARG_STRING, &chmod_dir_mode,"Directory mode for recordings", "OCTAL" },
{ "output-chown", 0, 0, G_OPTION_ARG_STRING, &user_uid, "File owner for recordings", "USER|UID" },
{ "output-chgrp", 0, 0, G_OPTION_ARG_STRING, &group_gid, "File group for recordings", "GROUP|GID" },
{ "output-buffer", 0, 0, G_OPTION_ARG_INT, &output_buffer, "I/O buffer size for writing files", "INT" },
{ "mysql-host", 0, 0, G_OPTION_ARG_STRING, &c_mysql_host, "MySQL host for storage of call metadata","HOST|IP" },
{ "mysql-port", 0, 0, G_OPTION_ARG_INT, &c_mysql_port, "MySQL port" ,"INT" },
{ "mysql-user", 0, 0, G_OPTION_ARG_STRING, &c_mysql_user, "MySQL connection credentials", "USERNAME" },
@ -339,6 +341,9 @@ static void options(int *argc, char ***argv) {
die("Invalid output pattern '%s' (no '%%c' format present)", output_pattern);
if (!strstr(output_pattern, "%t"))
die("Invalid output pattern '%s' (no '%%t' format present)", output_pattern);
if (output_buffer < 0)
die("Invalid negative output-buffer value");
}
static void options_free(void) {


+ 1
- 0
recording-daemon/main.h View File

@ -32,6 +32,7 @@ extern mode_t output_chmod_dir;
extern uid_t output_chown;
extern gid_t output_chgrp;
extern char *output_pattern;
extern int output_buffer;
extern gboolean decoding_enabled;
extern char *c_mysql_host,
*c_mysql_user,


+ 17
- 0
recording-daemon/output.c View File

@ -354,6 +354,22 @@ got_fn:
if (!output->fp)
goto err;
if (output_buffer > 0) {
err = "failed to alloc I/O buffer";
output->iobuf = g_malloc(output_buffer);
if (!output->iobuf)
goto err;
err = "failed to set I/O buffer";
if (setvbuf(output->fp, output->iobuf, _IOFBF, output_buffer))
goto err;
}
else {
err = "failed to set unuffered I/O";
if (setvbuf(output->fp, NULL, _IONBF, 0))
goto err;
}
err = "failed to alloc avio buffer";
void *avio_buf = av_malloc(DEFAULT_AVIO_BUFSIZE);
if (!avio_buf)
@ -465,6 +481,7 @@ void output_close(metafile_t *mf, output_t *output, tag_t *tag, bool discard) {
g_clear_pointer(&output->file_path, g_free);
g_clear_pointer(&output->file_name, g_free);
g_clear_pointer(&output->filename, g_free);
g_clear_pointer(&output->iobuf, g_free);
g_free(output);
}


+ 1
- 0
recording-daemon/types.h View File

@ -175,6 +175,7 @@ struct output_s {
int64_t start_time_us;
FILE *fp;
char *iobuf;
AVIOContext *avioctx;
AVFormatContext *fmtctx;
AVStream *avst;


Loading…
Cancel
Save