Merge branch 'v0.20.x'
This commit is contained in:
@@ -62,7 +62,7 @@ private:
|
||||
};
|
||||
|
||||
class PreparedVorbisEncoder final : public PreparedEncoder {
|
||||
float quality;
|
||||
float quality = 3;
|
||||
int bitrate;
|
||||
|
||||
public:
|
||||
@@ -97,7 +97,7 @@ PreparedVorbisEncoder::PreparedVorbisEncoder(const ConfigBlock &block)
|
||||
|
||||
value = block.GetBlockValue("bitrate");
|
||||
if (value == nullptr)
|
||||
throw std::runtime_error("neither bitrate nor quality defined");
|
||||
return;
|
||||
|
||||
quality = -2.0;
|
||||
|
||||
|
@@ -270,7 +270,10 @@ CdioParanoiaInputStream::Seek(offset_type new_offset)
|
||||
lsn_relofs = new_offset / CDIO_CD_FRAMESIZE_RAW;
|
||||
offset = new_offset;
|
||||
|
||||
cdio_paranoia_seek(para, lsn_from + lsn_relofs, SEEK_SET);
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
cdio_paranoia_seek(para, lsn_from + lsn_relofs, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -292,6 +295,8 @@ CdioParanoiaInputStream::Read(void *ptr, size_t length)
|
||||
|
||||
//current sector was changed ?
|
||||
if (lsn_relofs != buffer_lsn) {
|
||||
const ScopeUnlock unlock(mutex);
|
||||
|
||||
rbuf = cdio_paranoia_read(para, nullptr);
|
||||
|
||||
s_err = cdda_errors(drv);
|
||||
|
@@ -104,7 +104,13 @@ input_ffmpeg_open(const char *uri,
|
||||
size_t
|
||||
FfmpegInputStream::Read(void *ptr, size_t read_size)
|
||||
{
|
||||
auto result = avio_read(h, (unsigned char *)ptr, read_size);
|
||||
int result;
|
||||
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
result = avio_read(h, (unsigned char *)ptr, read_size);
|
||||
}
|
||||
|
||||
if (result <= 0) {
|
||||
if (result < 0)
|
||||
throw MakeFfmpegError(result, "avio_read() failed");
|
||||
@@ -126,7 +132,12 @@ FfmpegInputStream::IsEOF() noexcept
|
||||
void
|
||||
FfmpegInputStream::Seek(offset_type new_offset)
|
||||
{
|
||||
auto result = avio_seek(h, new_offset, SEEK_SET);
|
||||
int64_t result;
|
||||
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
result = avio_seek(h, new_offset, SEEK_SET);
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
throw MakeFfmpegError(result, "avio_seek() failed");
|
||||
|
@@ -87,14 +87,24 @@ input_file_open(gcc_unused const char *filename,
|
||||
void
|
||||
FileInputStream::Seek(offset_type new_offset)
|
||||
{
|
||||
reader.Seek((off_t)new_offset);
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
reader.Seek((off_t)new_offset);
|
||||
}
|
||||
|
||||
offset = new_offset;
|
||||
}
|
||||
|
||||
size_t
|
||||
FileInputStream::Read(void *ptr, size_t read_size)
|
||||
{
|
||||
size_t nbytes = reader.Read(ptr, read_size);
|
||||
size_t nbytes;
|
||||
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
nbytes = reader.Read(ptr, read_size);
|
||||
}
|
||||
|
||||
offset += nbytes;
|
||||
return nbytes;
|
||||
}
|
||||
|
@@ -125,9 +125,14 @@ input_smbclient_open(const char *uri,
|
||||
size_t
|
||||
SmbclientInputStream::Read(void *ptr, size_t read_size)
|
||||
{
|
||||
smbclient_mutex.lock();
|
||||
ssize_t nbytes = smbc_read(fd, ptr, read_size);
|
||||
smbclient_mutex.unlock();
|
||||
ssize_t nbytes;
|
||||
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
const std::lock_guard<Mutex> lock(smbclient_mutex);
|
||||
nbytes = smbc_read(fd, ptr, read_size);
|
||||
}
|
||||
|
||||
if (nbytes < 0)
|
||||
throw MakeErrno("smbc_read() failed");
|
||||
|
||||
@@ -138,9 +143,14 @@ SmbclientInputStream::Read(void *ptr, size_t read_size)
|
||||
void
|
||||
SmbclientInputStream::Seek(offset_type new_offset)
|
||||
{
|
||||
smbclient_mutex.lock();
|
||||
off_t result = smbc_lseek(fd, new_offset, SEEK_SET);
|
||||
smbclient_mutex.unlock();
|
||||
off_t result;
|
||||
|
||||
{
|
||||
const ScopeUnlock unlock(mutex);
|
||||
const std::lock_guard<Mutex> lock(smbclient_mutex);
|
||||
result = smbc_lseek(fd, new_offset, SEEK_SET);
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
throw MakeErrno("smbc_lseek() failed");
|
||||
|
||||
|
@@ -387,6 +387,7 @@ HttpdOutput::SendTag(const Tag &tag)
|
||||
|
||||
try {
|
||||
encoder->SendTag(tag);
|
||||
encoder->Flush();
|
||||
} catch (const std::runtime_error &) {
|
||||
/* ignore */
|
||||
}
|
||||
|
Reference in New Issue
Block a user