summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-06-02 23:15:17 +0200
committerChristian Grothoff <christian@grothoff.org>2020-06-02 23:15:17 +0200
commitab9b0ddaee63f3081c4b9f06da76d1a33c4868e2 (patch)
tree189256ec2e0dc6a231b098e82058652759e345d3
parent3b7f6f0ebb19171b324103deb83de5e297372c7e (diff)
misc cov fixes, largely without impact
-rw-r--r--ChangeLog3
-rw-r--r--src/main/extractor.c10
-rw-r--r--src/main/extractor_ipc.h10
-rw-r--r--src/main/extractor_ipc_gnu.c8
-rw-r--r--src/main/extractor_plugin_main.c12
-rw-r--r--src/plugins/previewopus_extractor.c13
6 files changed, 31 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f2416d..aad4c5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Tue 02 Jun 2020 11:14:43 PM CEST
+ Fixed missing initialization of duration in Opus extractor. -CG
+
Fri 23 Aug 2019 09:34:35 AM CEST
Fix invalid read for malformed DVI files (#5846). -CG
diff --git a/src/main/extractor.c b/src/main/extractor.c
index cb64b95..89d734d 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -419,13 +419,7 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
pos->channel = NULL;
}
}
- if (-1 == ready)
- {
- LOG ("Failed to initialize IPC shared memory, cannot extract\n");
- done = 1;
- }
- else
- done = 0;
+ done = 0;
while (! done)
{
struct EXTRACTOR_Channel *channels[plugin_count];
@@ -521,7 +515,7 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
}
}
/* if 'prp.file_finished', send 'abort' to plugins;
- if not, send 'seek' notification to plugins in range */
+ if not, send 'seek' notification to plugins in range */
for (pos = plugins; NULL != pos; pos = pos->next)
{
if (NULL == (channel = pos->channel))
diff --git a/src/main/extractor_ipc.h b/src/main/extractor_ipc.h
index 8e7fe09..691898b 100644
--- a/src/main/extractor_ipc.h
+++ b/src/main/extractor_ipc.h
@@ -92,7 +92,7 @@
struct InitMessage
{
/**
- * Set to MESSAGE_INIT_STATE.
+ * Set to #MESSAGE_INIT_STATE.
*/
unsigned char opcode;
@@ -133,7 +133,7 @@ struct InitMessage
struct StartMessage
{
/**
- * Set to MESSAGE_EXTRACT_START.
+ * Set to #MESSAGE_EXTRACT_START.
*/
unsigned char opcode;
@@ -171,7 +171,7 @@ struct StartMessage
struct UpdateMessage
{
/**
- * Set to MESSAGE_UPDATED_SHM.
+ * Set to #MESSAGE_UPDATED_SHM.
*/
unsigned char opcode;
@@ -221,7 +221,7 @@ struct UpdateMessage
struct SeekRequestMessage
{
/**
- * Set to MESSAGE_SEEK.
+ * Set to #MESSAGE_SEEK.
*/
unsigned char opcode;
@@ -263,7 +263,7 @@ struct SeekRequestMessage
struct MetaMessage
{
/**
- * Set to MESSAGE_META.
+ * Set to #MESSAGE_META.
*/
unsigned char opcode;
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c
index 5400636..06e4a1b 100644
--- a/src/main/extractor_ipc_gnu.c
+++ b/src/main/extractor_ipc_gnu.c
@@ -145,7 +145,7 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size)
#if SOMEBSD
/* this works on FreeBSD, not sure about others... */
tpath = getenv ("TMPDIR");
- if (tpath == NULL)
+ if (NULL == tpath)
tpath = "/tmp/";
#else
tpath = "/"; /* Linux */
@@ -153,10 +153,12 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size)
snprintf (shm->shm_name,
MAX_SHM_NAME,
"%sLE-%u-%u",
- tpath, getpid (),
+ tpath,
+ getpid (),
(unsigned int) RANDOM ());
if (-1 == (shm->shm_id = shm_open (shm->shm_name,
- O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)))
+ O_RDWR | O_CREAT,
+ S_IRUSR | S_IWUSR)))
{
LOG_STRERROR_FILE ("shm_open",
shm->shm_name);
diff --git a/src/main/extractor_plugin_main.c b/src/main/extractor_plugin_main.c
index fd4912f..b7b2996 100644
--- a/src/main/extractor_plugin_main.c
+++ b/src/main/extractor_plugin_main.c
@@ -120,7 +120,9 @@ plugin_env_seek (void *cls,
int whence)
{
struct ProcessingContext *pc = cls;
- struct SeekRequestMessage srm;
+ struct SeekRequestMessage srm = {
+ .opcode = MESSAGE_SEEK
+ };
struct UpdateMessage um;
uint64_t npos;
unsigned char reply;
@@ -380,7 +382,9 @@ plugin_env_send_proc (void *cls,
static int
handle_init_message (struct ProcessingContext *pc)
{
- struct InitMessage init;
+ struct InitMessage init = {
+ .opcode = MESSAGE_INIT_STATE
+ };
if (NULL != pc->shm)
{
@@ -457,7 +461,9 @@ handle_init_message (struct ProcessingContext *pc)
static int
handle_start_message (struct ProcessingContext *pc)
{
- struct StartMessage start;
+ struct StartMessage start = {
+ .opcode = MESSAGE_EXTRACT_START
+ };
struct EXTRACTOR_ExtractContext ec;
char done;
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c
index 0b9ab0b..9423dcd 100644
--- a/src/plugins/previewopus_extractor.c
+++ b/src/plugins/previewopus_extractor.c
@@ -232,6 +232,7 @@ open_output_file (
#if DEBUG
fprintf (stderr, "Could not find output file format\n");
#endif
+ error = AVERROR (ENOSYS);
goto cleanup;
}
@@ -241,6 +242,7 @@ open_output_file (
#if DEBUG
fprintf (stderr, "Could not find an OPUS encoder.\n");
#endif
+ error = AVERROR (ENOSYS);
goto cleanup;
}
@@ -1061,8 +1063,8 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
}
else
{
-#if DEBUG
duration = format_ctx->duration;
+#if DEBUG
fprintf (stderr,
"Duration: %lld\n",
format_ctx->duration);
@@ -1131,7 +1133,8 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
* If we have enough samples for the encoder, we encode them.
* At the end of the file, we pass the remaining samples to
* the encoder.
- */while (av_audio_fifo_size (fifo) >= output_frame_size ||
+ *///
+ while (av_audio_fifo_size (fifo) >= output_frame_size ||
(finished && av_audio_fifo_size (fifo) > 0))
{
/**
@@ -1201,10 +1204,8 @@ cleanup:
if (output_codec_context)
avcodec_close (output_codec_context);
- if (codec_ctx)
- avcodec_close (codec_ctx);
- if (format_ctx)
- avformat_close_input (&format_ctx);
+ avcodec_close (codec_ctx);
+ avformat_close_input (&format_ctx);
av_free (io_ctx);
}