Skip to content

Commit 6009a26

Browse files
authored
Eliminate TooManySeeks exception (#611)
Since commit bfa0504 (2015-08-24), there is no code in libopenshot which ever throws TooManySeeks. - Removed catch() statements for TooManySeeks from multiple functions - Removed the exception from Exceptions.h - in Qt/AudioPlaybackThread.h: - Removed the "SafeTimeSliceThread" class definition, as it only existed to catch TooManySeeks. - Replaced SafeTimeSliceThread with a standard juce::TimeSliceThread
1 parent e0daa0b commit 6009a26

File tree

7 files changed

+1
-40
lines changed

7 files changed

+1
-40
lines changed

src/AudioReaderSource.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ void AudioReaderSource::GetMoreSamplesFromReader()
9797

9898
} catch (const ReaderClosed & e) {
9999
break;
100-
} catch (const TooManySeeks & e) {
101-
break;
102100
} catch (const OutOfBoundsFrame & e) {
103101
break;
104102
}

src/Clip.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,6 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
717717

718718
} catch (const ReaderClosed & e) {
719719
// ...
720-
} catch (const TooManySeeks & e) {
721-
// ...
722720
} catch (const OutOfBoundsFrame & e) {
723721
// ...
724722
}

src/Exceptions.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,22 +365,6 @@ namespace openshot {
365365
virtual ~ResampleError() noexcept {}
366366
};
367367

368-
/// Exception when too many seek attempts happen
369-
class TooManySeeks : public ExceptionBase
370-
{
371-
public:
372-
std::string file_path;
373-
/**
374-
* @brief Constructor
375-
*
376-
* @param message A message to accompany the exception
377-
* @param file_path (optional) The input file being processed
378-
*/
379-
TooManySeeks(std::string message, std::string file_path="")
380-
: ExceptionBase(message), file_path(file_path) { }
381-
virtual ~TooManySeeks() noexcept {}
382-
};
383-
384368
/// Exception when a writer is closed, and a frame is requested
385369
class WriterClosed : public ExceptionBase
386370
{

src/FrameMapper.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,6 @@ std::shared_ptr<Frame> FrameMapper::GetOrCreateFrame(int64_t number)
369369

370370
} catch (const ReaderClosed & e) {
371371
// ...
372-
} catch (const TooManySeeks & e) {
373-
// ...
374372
} catch (const OutOfBoundsFrame & e) {
375373
// ...
376374
}

src/Qt/AudioPlaybackThread.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@
4040

4141
namespace openshot
4242
{
43-
struct SafeTimeSliceThread : juce::TimeSliceThread
44-
{
45-
SafeTimeSliceThread(const String & s) : juce::TimeSliceThread(s) {}
46-
void run()
47-
{
48-
try {
49-
juce::TimeSliceThread::run();
50-
} catch (const TooManySeeks & e) {
51-
// ...
52-
}
53-
}
54-
};
5543

5644
/**
5745
* @brief Singleton wrapper for AudioDeviceManager (to prevent multiple instances).
@@ -96,8 +84,7 @@ namespace openshot
9684
juce::WaitableEvent played;
9785
int buffer_size;
9886
bool is_playing;
99-
SafeTimeSliceThread time_thread;
100-
87+
juce::TimeSliceThread time_thread;
10188
/// Constructor
10289
AudioPlaybackThread();
10390
/// Destructor

src/Qt/PlayerPrivate.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ namespace openshot
174174

175175
} catch (const ReaderClosed & e) {
176176
// ...
177-
} catch (const TooManySeeks & e) {
178-
// ...
179177
} catch (const OutOfBoundsFrame & e) {
180178
// ...
181179
}

src/Timeline.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ std::shared_ptr<Frame> Timeline::GetOrCreateFrame(Clip* clip, int64_t number)
461461

462462
} catch (const ReaderClosed & e) {
463463
// ...
464-
} catch (const TooManySeeks & e) {
465-
// ...
466464
} catch (const OutOfBoundsFrame & e) {
467465
// ...
468466
}

0 commit comments

Comments
 (0)