Skip to content
Snippets Groups Projects
Commit fbb344fe authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Use different schedule mechanism

parent 0eade1e2
No related branches found
No related tags found
1 merge request!332Use different schedule mechanism
Pipeline #29034 passed
...@@ -164,7 +164,7 @@ static void run(ftl::Configurable *root) { ...@@ -164,7 +164,7 @@ static void run(ftl::Configurable *root) {
// Send channels on flush // Send channels on flush
auto flushhandle = pool.onFlushSet([sender,&encodable](ftl::data::FrameSet &fs, ftl::codecs::Channel c) { auto flushhandle = pool.onFlushSet([sender,&encodable](ftl::data::FrameSet &fs, ftl::codecs::Channel c) {
if (!fs.test(ftl::data::FSFlag::AUTO_SEND)) return true; if (c != Channel::EndFrame && !fs.test(ftl::data::FSFlag::AUTO_SEND)) return true;
// Always send data channels // Always send data channels
if ((int)c >= 32) sender->post(fs, c); if ((int)c >= 32) sender->post(fs, c);
......
...@@ -367,20 +367,20 @@ std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_findFrameset(int64_t ts) { ...@@ -367,20 +367,20 @@ std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_findFrameset(int64_t ts) {
* Note: Must occur inside a mutex lock. * Note: Must occur inside a mutex lock.
*/ */
std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_getFrameset() { std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_getFrameset() {
ftl::data::FrameSetPtr f;
auto i = framesets_.begin(); auto i = framesets_.begin();
int N = bufferSize_; int N = bufferSize_;
// Skip N frames to fixed buffer location // Skip N frames to fixed buffer location
if (bufferSize_ > 0) { if (bufferSize_ > 0) {
while (N-- > 0 && i != framesets_.end()) ++i; while (N-- > 0 && i != framesets_.end()) ++i;
// Otherwise skip to first fully completed frame if (i != framesets_.end()) f = *i;
} else { } else {
while (i != framesets_.end() && !(*i)->isComplete()) ++i; // Always choose oldest frameset when it completes
if (framesets_.size() > 0 && framesets_.back()->isComplete()) f = framesets_.back();
} }
if (i != framesets_.end()) { if (f) {
auto f = *i;
// Lock to force completion of on going construction first // Lock to force completion of on going construction first
UNIQUE_LOCK(f->smtx, slk); UNIQUE_LOCK(f->smtx, slk);
last_frame_ = f->timestamp(); last_frame_ = f->timestamp();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment