]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/fec'
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Jan 2021 15:14:13 +0000 (16:14 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Jan 2021 15:15:50 +0000 (16:15 +0100)
A single patch which improves the memory management of the
fec encoder.

Cooking for half a year.

* refs/heads/t/fec:
  vss: Fix NULL pointer dereference in vss_del_fec_client().
  vss: Rework fec client setup.

12 files changed:
NEWS.md
afs.c
aft.c
client_common.c
crypt.h
crypt_common.c
dccp_send.c
gui.c
gui_theme.c
m4/lls/server.suite.m4
mp.c
prebuffer_filter.c

diff --git a/NEWS.md b/NEWS.md
index de0aa1b462d3158e2325c383cd4cec7e569b46b9..6bd58962a55c4cda0d50d10815f84f1d7108fba9 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -29,6 +29,7 @@ NEWS
 - A fix for an old bug that could cause the server to crash or report
   garbage in its status output.
 - New para_play option: --end-of-playlist
+- Streaming m4a files over udp has been improved.
 
 --------------------------------------
 0.6.2 (2018-06-30) "elastic diversity"
diff --git a/afs.c b/afs.c
index 04eed5503d18cb6d3b6e4d0cb127f98637d36b5d..c4de2e8f37d5a94937f0fe3519715d40242f5329 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -1043,7 +1043,8 @@ static int com_init_callback(struct afs_callback_arg *aca)
        }
        ret = open_afs_tables();
        if (ret < 0)
-               para_printf(&aca->pbout, "cannot open afs tables\n");
+               para_printf(&aca->pbout, "cannot open afs tables: %s\n",
+                       para_strerror(-ret));
 out:
        return ret;
 }
diff --git a/aft.c b/aft.c
index b4adbacf6e2a93b17c25f11bacb9845c47538c53..eb955e019f538e3d73f38074ff657c9b86d2199d 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -407,7 +407,7 @@ static void load_chunk_table(struct afh_info *afhi, const struct osl_object *ct)
        int i;
        size_t sz;
 
-       if (!ct->data || ct->size < 4) {
+       if (!ct->data || ct->size < 4 * (afhi->chunks_total + 1)) {
                afhi->chunk_table = NULL;
                return;
        }
@@ -589,8 +589,10 @@ static int get_hash_of_row(const struct osl_row *row, unsigned char **hash)
 int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi)
 {
        struct osl_object obj;
-       int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_AFHI,
-               &obj));
+       int ret;
+
+       assert(row);
+       ret = osl(osl_get_object(audio_file_table, row, AFTCOL_AFHI, &obj));
        if (ret < 0)
                return ret;
        load_afhi(obj.data, afhi);
@@ -2534,10 +2536,12 @@ static int aft_open(const char *dir)
                PARA_NOTICE_LOG("current audio file hash lookup: success\n");
                return 1;
        }
-       PARA_NOTICE_LOG("failed to open audio file table\n");
        audio_file_table = NULL;
-       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT))
+       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT)) {
+               PARA_WARNING_LOG("no audio file table\n");
                return 1;
+       }
+       PARA_NOTICE_LOG("failed to open audio file table\n");
        return ret;
 }
 
@@ -2618,8 +2622,10 @@ static int aft_event_handler(enum afs_events event, struct para_buffer *pb,
                /*
                 * These events are rare. We don't bother to check whether the
                 * current status items are affected and simply recreate them
-                * every time.
+                * whenever an audio file is open.
                 */
+               if (!current_aft_row)
+                       return 0;
                ret = get_afhi_of_row(current_aft_row,
                        &status_item_ls_data.afhi);
                if (ret < 0)
index a7eee85d3cc0d5cf94073ca39c6223a7c4a639d4..dc24a6280acc068bd2cb7cbc0fb178bd8586ca54 100644 (file)
@@ -86,7 +86,7 @@ static void client_pre_select(struct sched *s, void *context)
                        else if (ret > 0)
                                para_fd_set(ct->scc.fd, &s->wfds, &s->max_fileno);
                }
-               /* fallthrough */
+               __attribute__ ((fallthrough));
        case CL_EXECUTING:
                if (ct->btrn[0]) {
                        ret = btr_node_status(ct->btrn[0], 0, BTR_NT_ROOT);
@@ -389,7 +389,7 @@ static int client_post_select(struct sched *s, void *context)
                                        btr_consume(ct->btrn[1], sz);
                        }
                }
-               /* fall through */
+               __attribute__ ((fallthrough));
        case CL_EXECUTING:
                if (ct->btrn[0]) {
                        ret = btr_node_status(ct->btrn[0], 0, BTR_NT_ROOT);
diff --git a/crypt.h b/crypt.h
index 85629591880ad03f2d2d010f194667be1db4c121..9623a0035a3b1a89818bd99c3c09c1dac041519b 100644 (file)
--- a/crypt.h
+++ b/crypt.h
@@ -158,7 +158,7 @@ _static_inline_ void sc_trafo(struct iovec *src, struct iovec *dst,
 /**
  * Deallocate a stream cipher structure.
  *
- * \param sc A stream cipher previously obtained by sc_new().
+ * \param sc A stream cipher previously obtained by \ref sc_new().
  */
 void sc_free(struct stream_cipher *sc);
 
@@ -188,7 +188,7 @@ void hash_function(const char *data, unsigned long len, unsigned char *hash);
  * will be filled by the function with the ascii representation of the hash
  * value given by \a hash, and a terminating \p NULL byte.
  */
-void hash_to_asc(unsigned char *hash, char *asc);
+void hash_to_asc(const unsigned char *hash, char *asc);
 
 /**
  * Compare two hashes.
@@ -199,4 +199,4 @@ void hash_to_asc(unsigned char *hash, char *asc);
  * \return 1, -1, or zero, depending on whether \a h1 is greater than,
  * less than or equal to h2, respectively.
  */
-int hash_compare(unsigned char *h1, unsigned char *h2);
+int hash_compare(const unsigned char *h1, const unsigned char *h2);
index c1e40d920ff425ccfdcc536c5fb69cd0422472ca..ff24e356ab8d837f8d59d67a3c983d5264376db1 100644 (file)
@@ -135,7 +135,7 @@ int check_private_key_file(const char *file)
        return 1;
 }
 
-void hash_to_asc(unsigned char *hash, char *asc)
+void hash_to_asc(const unsigned char *hash, char *asc)
 {
        int i;
        const char hexchar[] = "0123456789abcdef";
@@ -147,7 +147,7 @@ void hash_to_asc(unsigned char *hash, char *asc)
        asc[2 * HASH_SIZE] = '\0';
 }
 
-int hash_compare(unsigned char *h1, unsigned char *h2)
+int hash_compare(const unsigned char *h1, const unsigned char *h2)
 {
        int i;
 
index 55f189ad4eb01632dbcd653e104ef7f0cfe54ff8..bca7ad6781e29d2bb1bea686d3971e02ede59909 100644 (file)
@@ -232,6 +232,8 @@ static void dccp_send_init(void)
                OPT_RESULT(DCCP_LISTEN_ADDRESS),
                OPT_UINT32_VAL(DCCP_PORT), OPT_UINT32_VAL(DCCP_MAX_CLIENTS),
                OPT_GIVEN(DCCP_DEFAULT_DENY));
+       if (OPT_GIVEN(DCCP_NO_AUTOSTART))
+               return;
        generic_com_on(dss, IPPROTO_DCCP);
 }
 
diff --git a/gui.c b/gui.c
index a4f1717c2a996568d2fe36cc3a010f165ff1bcd9..d779ff864ddebfc38a34ba1a0d166b5c04089556 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -192,7 +192,7 @@ static bool curses_active(void)
 }
 
 /* taken from mutt */
-static char *km_keyname(int c)
+static const char *km_keyname(int c)
 {
        static char buf[10];
 
@@ -1049,6 +1049,7 @@ static void handle_command(int c)
 {
        int i;
        const struct lls_opt_result *lor = OPT_RESULT(KEY_MAP);
+       const char *keyname = km_keyname(c);
 
        /* first check user-defined key bindings */
        FOR_EACH_KEY_MAP(i) {
@@ -1059,7 +1060,7 @@ static void handle_command(int c)
                        free(tmp);
                        return;
                }
-               if (strcmp(tmp, km_keyname(c))) {
+               if (strcmp(tmp, keyname)) {
                        free(tmp);
                        continue;
                }
@@ -1079,13 +1080,13 @@ static void handle_command(int c)
        }
        /* not found, check internal key bindings */
        for (i = 0; command_list[i].handler; i++) {
-               if (!strcmp(km_keyname(c), command_list[i].key)) {
+               if (!strcmp(keyname, command_list[i].key)) {
                        command_list[i].handler();
                        return;
                }
        }
        print_in_bar(COLOR_ERRMSG, "key '%s' is not bound, press ? for help",
-               km_keyname(c));
+               keyname);
 }
 
 static int input_post_select(__a_unused struct sched *s,
index f0efaa8872bdb78a7efc423f7f4a2a9da5c15195..6f4acf37a318834f95614ccc1365c12208048b90 100644 (file)
@@ -149,7 +149,7 @@ static void init_theme_colorful_blackness(struct gui_theme *t)
        d[SI_format].align = CENTER;
        d[SI_format].x = 42;
        d[SI_format].y = 17;
-       d[SI_format].len = 18;
+       d[SI_format].len = 16;
 
        d[SI_num_played].prefix = "#";
        d[SI_num_played].postfix = "";
index be8f02f5fa4bda5101f0b2ffa67f5e4332ec0b64..93e4b573e5ae694581b5f111f1a898d45b6c4f7b 100644 (file)
@@ -273,6 +273,11 @@ version-string = GIT_VERSION()
                [help]
                        See --http-access for details.
                [/help]
+       [option dccp-no-autostart]
+               summary = do not open the DCCP port on startup
+               [help]
+                       This is like --http-no-autostart but applies to the dccp sender.
+               [/help]
        [option dccp-max-clients]
                summary = maximal number of simultaneous dccp connections
                arg_info = required_arg
diff --git a/mp.c b/mp.c
index bade05bcf866103b5bd794af4ae1ae6ce8cb5b72..56c16e31d7baf64fbf7c415b015b3de2967b6a38 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -491,10 +491,10 @@ int mp_init(const char *definition, int nbytes, struct mp_context **result,
        struct mp_context *ctx;
        struct yy_buffer_state *buffer_state;
 
+       *result = NULL;
        if (!definition || nbytes == 0) { /* dummy mood */
                if (errmsg)
                        *errmsg = NULL;
-               *result = NULL;
                return 0;
        }
        ctx = para_calloc(sizeof(*ctx));
index 05ceb88c5b93c4e7c52b4a55029f893d7ec2cd23..1988e6e0fcc2d0b5f13c215fa6857524e6442e43 100644 (file)
@@ -60,6 +60,9 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context)
        int ret;
 
        ret = task_get_notification(fn->task);
+       if (ret < 0)
+               return ret;
+       ret = btr_node_status(btrn, size, BTR_NT_INTERNAL);
        if (ret < 0)
                return ret;
        if (ppd->barrier.tv_sec == 0)