[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/core ReadSource.cpp
From: |
Ben Levitt |
Subject: |
[Traverso-commit] traverso/src/core ReadSource.cpp |
Date: |
Fri, 30 Nov 2007 07:25:22 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Ben Levitt <benjie> 07/11/30 07:25:22
Modified files:
src/core : ReadSource.cpp
Log message:
Make silent ReadSource instances safer.
(Don't crash when trying to process them, get their buffer_status, etc!)
This fixes another silent clip crash when coming in through
Track::process() => AudioClip::process() => ReadSource::rb_read()
Hopefully silent clips are solidly stable again...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.cpp?cvsroot=traverso&r1=1.84&r2=1.85
Patches:
Index: ReadSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- ReadSource.cpp 29 Nov 2007 19:52:18 -0000 1.84
+++ ReadSource.cpp 30 Nov 2007 07:25:22 -0000 1.85
@@ -206,6 +206,8 @@
m_length = TimeRef(LONG_LONG_MAX);
m_channelCount = 0;
m_origBitDepth = 16;
+ m_bufferstatus->fillStatus = 100;
+ m_bufferstatus->needSync = false;
return 1;
}
@@ -370,6 +372,10 @@
// static int runcount;
// runcount++;
+ if (m_channelCount == 0) {
+ return count;
+ }
+
if ( ! m_rbReady ) {
// printf("ringbuffer not ready\n");
return 0;
@@ -481,6 +487,10 @@
void ReadSource::process_ringbuffer(DecodeBuffer* buffer, bool seeking)
{
+ if (m_channelCount == 0) {
+ return;
+ }
+
// Do nothing if we passed the lenght of the AudioFile.
if (m_rbFileReadPos >= m_length) {
// printf("returning, m_rbFileReadPos > m_length! (%d > %d)\n",
m_rbFileReadPos.to_frame(get_rate()), m_audioReader->get_nframes());
@@ -614,6 +624,10 @@
BufferStatus* ReadSource::get_buffer_status()
{
+ if (m_channelCount == 0) {
+ return m_bufferstatus;
+ }
+
int freespace = m_buffers.at(0)->write_space();
// printf("m_rbFileReadPos, m_length %lld, %lld\n",
m_rbFileReadPos.universal_frame(), m_length.universal_frame());