From 8e7a15754a3fef09cc5de372f207936740459c56 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 26 Jun 2019 10:57:58 +0200 Subject: Refactor OrderedQueue a bit --- src/AVTInput.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/AVTInput.cpp') diff --git a/src/AVTInput.cpp b/src/AVTInput.cpp index 973ed7b..0e5b669 100644 --- a/src/AVTInput.cpp +++ b/src/AVTInput.cpp @@ -69,9 +69,7 @@ AVTInput::AVTInput(const std::string& input_uri, _input_pad_packet(2048), _ordered(5000, _jitterBufferSize), _lastInfoFrameType(_typeCantExtract) -{ - -} +{ } int AVTInput::prepare(void) { @@ -430,14 +428,13 @@ ssize_t AVTInput::getNextFrame(std::vector &buf) //printf("B: _padFrameQueue size=%zu\n", _padFrameQueue.size()); // Assemble next frame - int32_t nb = 0; std::vector part; - while (_nbFrames < 5 && (nb = _ordered.pop(part)) != 0) + while (_nbFrames < 5 and not (part = _ordered.pop()).empty()) { while (_checkMessage()); - memcpy(_currentFrame.data() + _currentFrameSize, part.data(), nb); - _currentFrameSize += nb; + memcpy(_currentFrame.data() + _currentFrameSize, part.data(), part.size()); + _currentFrameSize += part.size(); _nbFrames ++; } -- cgit v1.2.3