summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c4
-rw-r--r--main/channel.c21
-rw-r--r--main/config.c4
-rw-r--r--main/manager.c4
-rw-r--r--main/rtp_engine.c2
5 files changed, 27 insertions, 8 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 4c15d231f..e348b2199 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -331,6 +331,7 @@ int option_verbose; /*!< Verbosity level */
int option_debug; /*!< Debug level */
int ast_pjproject_max_log_level = -1;/* Default to -1 to know if we have read the level from pjproject yet. */
int ast_option_pjproject_log_level;
+int ast_option_pjproject_cache_pools;
double ast_option_maxload; /*!< Max load avg on system */
int ast_option_maxcalls; /*!< Max number of active calls */
int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
@@ -3744,6 +3745,7 @@ static void read_pjproject_startup_options(void)
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE | CONFIG_FLAG_NOREALTIME };
ast_option_pjproject_log_level = DEFAULT_PJ_LOG_MAX_LEVEL;
+ ast_option_pjproject_cache_pools = DEFAULT_PJPROJECT_CACHE_POOLS;
cfg = ast_config_load2("pjproject.conf", "" /* core, can't reload */, config_flags);
if (!cfg
@@ -3762,6 +3764,8 @@ static void read_pjproject_startup_options(void)
} else if (MAX_PJ_LOG_MAX_LEVEL < ast_option_pjproject_log_level) {
ast_option_pjproject_log_level = MAX_PJ_LOG_MAX_LEVEL;
}
+ } else if (!strcasecmp(v->name, "cache_pools")) {
+ ast_option_pjproject_cache_pools = !ast_false(v->value);
}
}
diff --git a/main/channel.c b/main/channel.c
index 7eb40d195..c71d19b81 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3667,7 +3667,17 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio, int
* originated from and update the frame to include it.
*/
stream = default_stream = ast_channel_get_default_stream(chan, ast_format_get_type(f->subclass.format));
- f->stream_num = ast_stream_get_position(stream);
+ /* In order to allow media to be passed up the underlying media type has to have a format negotiated on
+ * the channel itself. In cases where this hasn't happened the channel driver is incorrectly passing up
+ * a frame for a format that has not been negotiated. If this occurs just drop the frame as we have no
+ * stream that it came from.
+ */
+ if (!stream) {
+ ast_frfree(f);
+ f = &ast_null_frame;
+ } else {
+ f->stream_num = ast_stream_get_position(stream);
+ }
}
}
} else {
@@ -3700,7 +3710,12 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio, int
*/
if (f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) {
stream = default_stream = ast_channel_get_default_stream(chan, ast_format_get_type(f->subclass.format));
- f->stream_num = ast_stream_get_position(stream);
+ if (!stream) {
+ ast_frfree(f);
+ f = &ast_null_frame;
+ } else {
+ f->stream_num = ast_stream_get_position(stream);
+ }
}
}
else
@@ -3790,7 +3805,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio, int
ast_frfree(f);
f = &ast_null_frame;
} else if (f->subclass.integer == AST_CONTROL_STREAM_TOPOLOGY_CHANGED && dropnondefault) {
- /* The caller of this function is incapable of handling streams so we absord the notification that the
+ /* The caller of this function is incapable of handling streams so we absorb the notification that the
* stream topology has changed.
*/
ast_frfree(f);
diff --git a/main/config.c b/main/config.c
index 118b9586e..8107fce04 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2195,10 +2195,10 @@ static struct ast_config *config_text_file_load(const char *database, const char
lineno++;
if (fgets(buf, sizeof(buf), f)) {
/* Skip lines that are too long */
- if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 1] != '\n') {
+ if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 2] != '\n') {
ast_log(LOG_WARNING, "Line %d too long, skipping. It begins with: %.32s...\n", lineno, buf);
while (fgets(buf, sizeof(buf), f)) {
- if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 1] == '\n') {
+ if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 2] == '\n') {
break;
}
}
diff --git a/main/manager.c b/main/manager.c
index 177959ac8..b698702af 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -7672,7 +7672,7 @@ static void process_output(struct mansession *s, struct ast_str **out, struct as
fd = ast_iostream_get_fd(s->stream);
- l = lseek(fd, SEEK_CUR, 0);
+ l = lseek(fd, 0, SEEK_CUR);
if (l > 0) {
if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0))) {
ast_log(LOG_WARNING, "mmap failed. Manager output was not processed\n");
@@ -8174,7 +8174,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
m.headers[idx] = NULL;
}
- result_size = lseek(ast_iostream_get_fd(s.stream), SEEK_CUR, 0); /* Calculate approx. size of result */
+ result_size = lseek(ast_iostream_get_fd(s.stream), 0, SEEK_CUR); /* Calculate approx. size of result */
http_header = ast_str_create(80);
out = ast_str_create(result_size * 2 + 512);
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index f108a703b..627605a1a 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1216,7 +1216,7 @@ struct ast_rtp_payload_type *ast_rtp_codecs_get_payload(struct ast_rtp_codecs *c
}
ast_rwlock_unlock(&codecs->codecs_lock);
- if (!type) {
+ if (!type && payload <= AST_RTP_PT_LAST_STATIC) {
ast_rwlock_rdlock(&static_RTP_PT_lock);
type = ao2_bump(static_RTP_PT[payload]);
ast_rwlock_unlock(&static_RTP_PT_lock);