Skip to content

Commit cbd4700

Browse files
author
Valentin NOEL
committed
StreamTranscoder: reset frame that has not been decoded
Avoid filling the filter graph buffers with wrong data frames. Improve documentation into FilterGraph::FrameBuffer class.
1 parent 82382fc commit cbd4700

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/AvTranscoder/filter/FilterGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ FrameBuffer::~FrameBuffer()
3838

3939
void FrameBuffer::addFrame(IFrame* frame)
4040
{
41-
LOG_DEBUG("Add a new frame to frame buffer. New buffer size: " << _frameQueue.size() + 1);
41+
LOG_DEBUG("Add a new " << frame->getDataSize() << " bytes frame to frame buffer. New buffer size: " << _frameQueue.size() + 1);
4242
// Copy the input frame to store it into the queue
4343
AudioFrame* newAudioFrame = new AudioFrame(_audioFrameDesc, false);
4444
const size_t expectedNbSamples = frame->getDataSize() / (newAudioFrame->getNbChannels() * newAudioFrame->getBytesPerSample());

src/AvTranscoder/filter/FilterGraph.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FrameBuffer
3232
*/
3333
bool isEmpty() const { return _frameQueue.empty() && _totalDataSize == 0; }
3434
/**
35-
* @brief Return the total amount of data contained in the frames of the buffer.
35+
* @brief Return the total amount of available data contained in the frames of the buffer.
3636
*/
3737
size_t getDataSize() const { return _totalDataSize; }
3838
/**

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,11 @@ bool StreamTranscoder::processTranscode()
582582
continue;
583583
}
584584
LOG_DEBUG("Some frames remain into filter graph buffer " << index);
585+
586+
// Reset the non-decoded data as an empty frame
587+
_decodedData.at(index)->freeData();
588+
_decodedData.at(index)->getAVFrame().format = -1;
589+
_decodedData.at(index)->getAVFrame().nb_samples = 0;
585590
}
586591
}
587592

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy