summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2014-12-17 23:50:07 -0500
committerRJ Ryan <rryan@mixxx.org>2014-12-17 23:55:36 -0500
commitd15a2b97cbabd689a1b43c17c2328749b117fbc9 (patch)
tree05d40ba0c7daf7c2f7555fe9a68f0eb53d596a51 /plugins
parent1eaca501c86ea7004f382107c485e2014cfadae3 (diff)
Convert most Q_ASSERTs into DEBUG_ASSERT_AND_HANDLEs.
Handle errors gracefully in release builds.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/soundsourcem4a/m4a/mp4-mixxx.cpp6
-rw-r--r--plugins/soundsourcem4a/soundsourcem4a.cpp7
2 files changed, 11 insertions, 2 deletions
diff --git a/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp b/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp
index d6503f7239..0ab967af34 100644
--- a/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp
+++ b/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include "util/math.h"
+#include "util/assert.h"
/*
* Copyright 2006 dnk <dnk@bjum.net>
@@ -407,7 +408,10 @@ static int mp4_seek_sample(struct input_plugin_data *ip_data, int sample)
struct mp4_private *priv;
priv = (mp4_private*) ip_data->private_ipd;
- Q_ASSERT(sample >= 0);
+ // Ignore the seek if the sample is invalid.
+ DEBUG_ASSERT_AND_HANDLE(sample >= 0) {
+ return mp4_current_sample(ip_data);
+ }
// The first frame is samples 0 through 2047. The first sample of the second
// frame is 2048. 2048 / 2048 = 1, so frame_for_sample will be 2 on the
// 2048'th sample. The frame_offset_samples is how many samples into the frame
diff --git a/plugins/soundsourcem4a/soundsourcem4a.cpp b/plugins/soundsourcem4a/soundsourcem4a.cpp
index c8399d7555..8932bacfef 100644
--- a/plugins/soundsourcem4a/soundsourcem4a.cpp
+++ b/plugins/soundsourcem4a/soundsourcem4a.cpp
@@ -17,6 +17,7 @@
#include "soundsourcem4a.h"
#include "soundsourcetaglib.h"
#include "sampleutil.h"
+#include "util/assert.h"
#include <taglib/mp4file.h>
#include <neaacdec.h>
@@ -91,7 +92,11 @@ int SoundSourceM4A::initializeDecoder()
// mp4_open succeeded -> populate variables
mp4_private* mp = (struct mp4_private*)ipd.private_ipd;
- Q_ASSERT(mp);
+ DEBUG_ASSERT_AND_HANDLE(mp) {
+ mp4_close(&ipd);
+ return ERR;
+ }
+
mp4file = mp->mp4.handle;
filelength = mp4_total_samples(&ipd);
setSampleRate(mp->sample_rate);