summaryrefslogtreecommitdiffstats
path: root/src/sources/audiosource.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uwe_klotz@web.de>2016-07-26 23:28:14 +0200
committerUwe Klotz <uwe_klotz@web.de>2016-07-27 09:12:42 +0200
commit6c2d18ffaa3e6fec2ca0669904fe678513d98d78 (patch)
tree812a812bc53d565151641211338b6aab00bd827a /src/sources/audiosource.cpp
parent3f7906deaf3ef118f8fe4fee41c65a208288a1b9 (diff)
Verify various properties before reading from audio sources
Diffstat (limited to 'src/sources/audiosource.cpp')
-rw-r--r--src/sources/audiosource.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sources/audiosource.cpp b/src/sources/audiosource.cpp
index 9f6df3f934..d17a476efc 100644
--- a/src/sources/audiosource.cpp
+++ b/src/sources/audiosource.cpp
@@ -92,4 +92,23 @@ SINT AudioSource::readSampleFramesStereo(
}
}
+bool AudioSource::verifyReadable() const {
+ bool result = AudioSignal::verifyReadable();
+ if (hasBitrate()) {
+ DEBUG_ASSERT_AND_HANDLE(isValidBitrate(m_bitrate)) {
+ qWarning() << "Invalid bitrate [kbps]:"
+ << getBitrate();
+ // Don't set the result to false, because bitrate is only
+ // an informational property that does not effect the ability
+ // to decode audio data!
+ }
+ }
+ if (isEmpty()) {
+ qWarning() << "AudioSource is empty and does not provide any audio data!";
+ // Don't set the result to false, even if reading from an empty source
+ // is pointless!
+ }
+ return result;
+}
+
}