Simplified interface + fixed segfault when eof is reached. ref #287
This commit is contained in:
@@ -46,6 +46,8 @@ namespace Av
|
||||
{
|
||||
if (_estimatedContentLength)
|
||||
LMS_LOG(TRANSCODE, DEBUG) << "Estimated content length = " << *_estimatedContentLength;
|
||||
else
|
||||
LMS_LOG(TRANSCODE, DEBUG) << "Not using estimated content length";
|
||||
}
|
||||
|
||||
Wt::Http::ResponseContinuation*
|
||||
@@ -58,8 +60,8 @@ namespace Av
|
||||
if (_bytesReadyCount > 0)
|
||||
{
|
||||
response.out().write(reinterpret_cast<const char *>(&_buffer[0]), _bytesReadyCount);
|
||||
_bytesReadyCount = 0;
|
||||
_totalServedByteCount += _bytesReadyCount;
|
||||
_bytesReadyCount = 0;
|
||||
}
|
||||
|
||||
if (!_transcoder.finished())
|
||||
|
||||
@@ -178,19 +178,6 @@ Transcoder::start()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Transcoder::asyncWaitForData(WaitCallback cb)
|
||||
{
|
||||
assert(_childProcess);
|
||||
|
||||
LOG(DEBUG) << "Want to wait for data";
|
||||
|
||||
_childProcess->asyncWaitForData([cb = std::move(cb)]
|
||||
{
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
Transcoder::asyncRead(std::byte* buffer, std::size_t bufferSize, ReadCallback readCallback)
|
||||
{
|
||||
|
||||
@@ -40,9 +40,6 @@ namespace Av
|
||||
Transcoder(Transcoder&&) = delete;
|
||||
Transcoder& operator=(Transcoder&&) = delete;
|
||||
|
||||
using WaitCallback = std::function<void()>;
|
||||
void asyncWaitForData(WaitCallback cb);
|
||||
|
||||
// non blocking calls
|
||||
using ReadCallback = std::function<void(std::size_t nbReadBytes)>;
|
||||
void asyncRead(std::byte* buffer, std::size_t bufferSize, ReadCallback);
|
||||
|
||||
Reference in New Issue
Block a user