MT#61822 add media-files-reload option

Change-Id: Ica0aaa49a772ce7a078858d720a215de5bb557f6
pull/1897/head
Richard Fuchs 4 months ago
parent ab0c2b0528
commit 5ba1793aff

@ -674,6 +674,7 @@ static void options(int *argc, char ***argv, GHashTable *templates) {
{ "kernel-player",0,0, G_OPTION_ARG_INT, &rtpe_config.kernel_player,"Max number of kernel media player streams","INT"},
{ "kernel-player-media",0,0,G_OPTION_ARG_INT, &rtpe_config.kernel_player_media,"Max number of kernel media files","INT"},
{ "preload-media-files",0,0,G_OPTION_ARG_FILENAME_ARRAY,&rtpe_config.preload_media_files,"Preload media file(s) for playback into memory","FILE"},
{ "media-files-reload",0,0,G_OPTION_ARG_INT, &rtpe_config.media_refresh,"Refresh/reload preloaded media files at a certain interval","SECONDS"},
{ "audio-buffer-length",0,0, G_OPTION_ARG_INT,&rtpe_config.audio_buffer_length,"Length in milliseconds of audio buffer","INT"},
{ "audio-buffer-delay",0,0, G_OPTION_ARG_INT,&rtpe_config.audio_buffer_delay,"Initial delay in milliseconds for buffered audio","INT"},
{ "audio-player",0,0, G_OPTION_ARG_STRING, &use_audio_player, "When to enable the internal audio player","on-demand|play-media|transcoding|always"},
@ -1586,6 +1587,9 @@ int main(int argc, char **argv) {
/* thread to refresh DTLS certificate */
dtls_timer();
thread_create_looper(media_player_refresh_timer, rtpe_config.idle_scheduling,
rtpe_config.idle_priority, "media refresh", rtpe_config.media_refresh * 1000000LL);
if (!is_addr_unspecified(&rtpe_config.redis_ep.address) && initial_rtpe_config.redis_delete_async)
thread_create_detach(redis_delete_async_loop, NULL, "redis async");

@ -1988,3 +1988,12 @@ unsigned int media_player_reload_files(void) {
return ret;
}
enum thread_looper_action media_player_refresh_timer(void) {
if (rtpe_config.media_refresh <= 0)
return TLA_BREAK;
media_player_reload_files();
return TLA_CONTINUE;
}

@ -1159,6 +1159,14 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp-
file name differs (or an entirely different file is requested for playback)
then playback will happen from file as usual.
- __\-\-media-files-reload=__*SECONDS*
Spawn a background thread to periodically check and, if needed, update
media files kept in the memory cache. Each file's modification timestamp is
checked against the last time it was read, and if the file was updated
since then, it will be re-read and will replace the previous cached
contents.
- __\-\-audio-buffer-length=__*INT*
Set the buffer length used by the audio player (see below) in milliseconds. The

@ -166,6 +166,7 @@ recording-method = proc
# moh-attr-name = rtpengine-hold
# preload-media-files = /var/media/file1.wav ; /var/media/file2.wav ; /var/media/file3.wav
# media-files-reload = 60
# signalling templates (see key `templates` above)
[templates]

@ -92,7 +92,8 @@ enum endpoint_learning {
X(mqtt_publish_interval) \
X(rtcp_interval) \
X(cpu_affinity) \
X(max_recv_iters)
X(max_recv_iters) \
X(media_refresh) \
#define RTPE_CONFIG_UINT64_PARAMS \
X(bw_limit)

@ -152,6 +152,7 @@ void media_player_launch(void);
bool media_player_preload_files(char **);
bool media_player_reload_file(str *name);
unsigned int media_player_reload_files(void);
enum thread_looper_action media_player_refresh_timer(void);
struct send_timer *send_timer_new(struct packet_stream *);
void send_timer_push(struct send_timer *, struct codec_packet *);

Loading…
Cancel
Save