Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
94c9fafe
Commit
94c9fafe
authored
Jul 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/chromaprint/DecoderClient: catch and postpone InputStream::LockRead() errors
parent
8480b834
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
FingerprintCommands.cxx
src/command/FingerprintCommands.cxx
+6
-1
DecoderClient.cxx
src/lib/chromaprint/DecoderClient.cxx
+9
-1
DecoderClient.hxx
src/lib/chromaprint/DecoderClient.hxx
+9
-1
No files found.
src/command/FingerprintCommands.cxx
View file @
94c9fafe
...
...
@@ -305,7 +305,12 @@ GetChromaprintCommand::Read(InputStream &is, void *buffer, size_t length)
cond
.
wait
(
lock
);
}
return
is
.
Read
(
lock
,
buffer
,
length
);
try
{
return
is
.
Read
(
lock
,
buffer
,
length
);
}
catch
(...)
{
ChromaprintDecoderClient
::
error
=
std
::
current_exception
();
return
0
;
}
}
CommandResult
...
...
src/lib/chromaprint/DecoderClient.cxx
View file @
94c9fafe
...
...
@@ -28,6 +28,9 @@ ChromaprintDecoderClient::~ChromaprintDecoderClient() noexcept = default;
void
ChromaprintDecoderClient
::
Finish
()
{
if
(
error
)
std
::
rethrow_exception
(
error
);
if
(
!
ready
)
throw
std
::
runtime_error
(
"Decoding failed"
);
...
...
@@ -86,5 +89,10 @@ ChromaprintDecoderClient::SubmitData(InputStream *,
size_t
ChromaprintDecoderClient
::
Read
(
InputStream
&
is
,
void
*
buffer
,
size_t
length
)
{
return
is
.
LockRead
(
buffer
,
length
);
try
{
return
is
.
LockRead
(
buffer
,
length
);
}
catch
(...)
{
error
=
std
::
current_exception
();
return
0
;
}
}
src/lib/chromaprint/DecoderClient.hxx
View file @
94c9fafe
...
...
@@ -24,6 +24,7 @@
#include "decoder/Client.hxx"
#include "thread/Mutex.hxx"
#include <exception>
#include <memory>
#include <stdint.h>
...
...
@@ -39,6 +40,13 @@ class ChromaprintDecoderClient : public DecoderClient {
uint64_t
remaining_bytes
;
protected
:
/**
* This is set when an I/O error occurs while decoding; it
* will be rethrown by Finish().
*/
std
::
exception_ptr
error
;
public
:
Mutex
mutex
;
...
...
@@ -63,7 +71,7 @@ public:
bool
seekable
,
SignedSongTime
duration
)
override
;
DecoderCommand
GetCommand
()
noexcept
override
{
return
remaining_bytes
>
0
return
!
error
&&
remaining_bytes
>
0
?
DecoderCommand
::
NONE
:
DecoderCommand
::
STOP
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment