MT#61822 add db-cache-reload

Change-Id: I4976329d2a778fc9a87773a2d85c48bc1b0977ba
pull/1897/head
Richard Fuchs 1 year ago
parent 4755594f90
commit dcdeb6a9de

@ -679,6 +679,7 @@ static void options(int *argc, char ***argv, GHashTable *templates) {
{ "db-media-reload",0,0,G_OPTION_ARG_INT, &rtpe_config.db_refresh,"Reload preloaded media from DB at a certain interval","SECONDS"},
{ "db-media-cache",0,0, G_OPTION_ARG_FILENAME, &rtpe_config.db_media_cache,"Directory to store media loaded from database","PATH"},
{ "preload-db-cache",0,0,G_OPTION_ARG_STRING_ARRAY,&rtpe_config.preload_db_cache,"Preload media from database for playback into file cache","INT"},
{ "db-cache-reload",0,0,G_OPTION_ARG_INT, &rtpe_config.cache_refresh,"Refresh/reload cached media from DB 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"},
@ -1609,6 +1610,9 @@ int main(int argc, char **argv) {
thread_create_looper(media_player_refresh_db, rtpe_config.idle_scheduling,
rtpe_config.idle_priority, "db refresh", rtpe_config.db_refresh * 1000000LL);
thread_create_looper(media_player_refresh_cache, rtpe_config.idle_scheduling,
rtpe_config.idle_priority, "cache refresh", rtpe_config.cache_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");

@ -2263,6 +2263,15 @@ enum thread_looper_action media_player_refresh_db(void) {
return TLA_CONTINUE;
}
enum thread_looper_action media_player_refresh_cache(void) {
if (rtpe_config.cache_refresh <= 0)
return TLA_BREAK;
media_player_reload_caches();
return TLA_CONTINUE;
}
#ifdef WITH_TRANSCODING
// media_player_media_files_names_lock must be held
// media_player_media_files_lock must not be held

@ -1205,6 +1205,11 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp-
instead of storing the media in memory. On-demand loading is also
supported.
- __\-\-cache-media-reload=__*SECONDS*
Similar to the __db-media-reload__ but applicable to media stored in the
filesystem-backed cache.
- __\-\-audio-buffer-length=__*INT*
Set the buffer length used by the audio player (see below) in milliseconds. The

@ -171,6 +171,7 @@ recording-method = proc
# db-media-reload = 3600
# db-media-cache = /var/cache/rtpengine
# preload-db-cache = 1; 2; 3; 4; on-demand
# cache-media-reload = 3600
# signalling templates (see key `templates` above)
[templates]

@ -95,6 +95,7 @@ enum endpoint_learning {
X(max_recv_iters) \
X(media_refresh) \
X(db_refresh) \
X(cache_refresh) \
#define RTPE_CONFIG_UINT64_PARAMS \
X(bw_limit)

@ -169,6 +169,7 @@ unsigned int media_player_evict_caches(void);
bool media_player_preload_cache(char **);
bool media_player_reload_cache(unsigned long long);
unsigned int media_player_reload_caches(void);
enum thread_looper_action media_player_refresh_cache(void);
struct send_timer *send_timer_new(struct packet_stream *);
void send_timer_push(struct send_timer *, struct codec_packet *);

Loading…
Cancel
Save