[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/core DiskIO.cpp DiskIO.h ReadSourc...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/core DiskIO.cpp DiskIO.h ReadSourc... |
Date: |
Sat, 24 Nov 2007 14:02:07 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/11/24 14:02:07
Modified files:
src/core : DiskIO.cpp DiskIO.h ReadSource.cpp ReadSource.h
Log message:
* minor cleanup
* attempt to optimize DiskIO::there_are_processable_sources( ) a bit
(specially when there are many read/write sources)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/DiskIO.cpp?cvsroot=traverso&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/DiskIO.h?cvsroot=traverso&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.cpp?cvsroot=traverso&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.h?cvsroot=traverso&r1=1.41&r2=1.42
Patches:
Index: DiskIO.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/DiskIO.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- DiskIO.cpp 5 Nov 2007 15:49:30 -0000 1.51
+++ DiskIO.cpp 24 Nov 2007 14:02:07 -0000 1.52
@@ -251,7 +251,7 @@
source->process_ringbuffer(framebuffer[0]);
}
- if (whilecount++ > 1000) {
+ if (whilecount++ > 2000) {
printf("DiskIO::do_work -> probably detected a loop
here, or do_work() is REALLY buzy!!\n");
break;
}
@@ -267,13 +267,30 @@
{
m_processableReadSources.clear();
m_processableWriteSources.clear();
+ m_readersStatus.clear();
+ m_writersStatus.clear();
QList<ReadSource* > syncSources;
- for (int i=(bufferdividefactor-2); i >= 0; --i) {
for (int j=0; j<m_writeSources.size(); ++j) {
WriteSource* source = m_writeSources.at(j);
int space = source->get_processable_buffer_space();
+ QPair<int, WriteSource*> data(space, source);
+ m_writersStatus.append(data);
+ }
+
+ for (int j=0; j<m_readSources.size(); ++j) {
+ ReadSource* source = m_readSources.at(j);
+ BufferStatus* status = source->get_buffer_status();
+ m_readersStatus.append(QPair<BufferStatus*,
ReadSource*>(status, source));
+ }
+
+
+ for (int i=(bufferdividefactor-2); i >= 0; --i) {
+
+ for(int pair=0; pair<m_writersStatus.size(); ++pair) {
+ WriteSource* source = m_writersStatus.at(pair).second;
+ int space = m_writersStatus.at(pair).first;
int prio = (int) (space / source->get_chunck_size());
// If the source stopped recording, it will write it's
remaining samples in the next
@@ -294,12 +311,11 @@
}
}
- for (int j=0; j<m_readSources.size(); ++j) {
-
- ReadSource* source = m_readSources.at(j);
- BufferStatus* status = source->get_buffer_status();
+ for(int pair=0; pair<m_readersStatus.size(); ++pair) {
+ ReadSource* source = m_readersStatus.at(pair).second;
+ BufferStatus* status = m_readersStatus.at(pair).first;
- if (status->priority > i && source->is_active() &&
!status->needSync ) {
+ if (status->priority > i && !status->needSync ) {
if ( (! m_seeking) && status->bufferUnderRun ) {
if (! m_hardDiskOverLoadCounter++) {
@@ -315,7 +331,7 @@
m_processableReadSources.append(source);
} else if (status->needSync) {
-// printf("status == bufferUnderRun\n");
+ // printf("status == bufferUnderRun\n");
if (syncSources.size() == 0) {
syncSources.append(source);
}
Index: DiskIO.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/DiskIO.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- DiskIO.h 12 Oct 2007 19:38:51 -0000 1.24
+++ DiskIO.h 24 Nov 2007 14:02:07 -0000 1.25
@@ -76,6 +76,8 @@
QList<WriteSource*> m_writeSources;
QList<ReadSource*> m_processableReadSources;
QList<WriteSource*> m_processableWriteSources;
+ QList<QPair<BufferStatus*, ReadSource*> > m_readersStatus;
+ QList<QPair<int, WriteSource*> > m_writersStatus;
DiskIOThread* m_diskThread;
QTimer m_workTimer;
QMutex mutex;
Index: ReadSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- ReadSource.cpp 24 Nov 2007 12:29:57 -0000 1.80
+++ ReadSource.cpp 24 Nov 2007 14:02:07 -0000 1.81
@@ -282,7 +282,7 @@
// The length could have become slightly smaller/larger due
// rounding issues involved with converting to one samplerate to
another.
- // Should be at the order of one sample at most, but for reading
purposes we
+ // Should be at the order of one - two samples at most, but for reading
purposes we
// need sample accurate information!
m_length = m_audioReader->get_length();
}
@@ -418,7 +418,6 @@
// We either passed the end of the file, or our audio reader
// is doing weird things, is broken, invalid or something else
// Set the rinbuffer file readpos to m_length so processing
stops here!
- // * Due resample rounding issues, we nev
m_rbFileReadPos = m_length;
}
@@ -600,7 +599,7 @@
// printf("m_rbFileReadPos, m_length %lld, %lld\n",
m_rbFileReadPos.universal_frame(), m_length.universal_frame());
- if (m_rbFileReadPos >= m_length) {
+ if (m_rbFileReadPos >= m_length || !m_active) {
m_bufferstatus->fillStatus = 100;
freespace = 0;
} else {
@@ -622,10 +621,7 @@
if (active) {
m_active = 1;
-// m_wasActivated = 1;
-// printf("setting private readsource %s to active\n",
QS_C(m_fileName));
} else {
-// printf("setting private readsource %s to IN-active\n",
QS_C(m_fileName));
m_active = 0;
}
}
@@ -649,6 +645,5 @@
if (m_audioReader) {
m_audioReader->set_resample_decode_buffer(m_diskio->get_resample_decode_buffer());
}
-
}
Index: ReadSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- ReadSource.h 12 Oct 2007 19:38:51 -0000 1.41
+++ ReadSource.h 24 Nov 2007 14:02:07 -0000 1.42
@@ -75,7 +75,6 @@
void sync(DecodeBuffer* buffer);
void process_ringbuffer(DecodeBuffer* buffer, bool seeking=false);
void prepare_rt_buffers();
- size_t is_active() const;
BufferStatus* get_buffer_status();
void set_output_rate(int rate, bool forceRate=false);
@@ -118,10 +117,4 @@
void stateChanged();
};
-
-inline size_t ReadSource::is_active() const
-{
- return m_active;
-}
-
#endif
- [Traverso-commit] traverso/src/core DiskIO.cpp DiskIO.h ReadSourc...,
Remon Sijrier <=