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) {
// Send channels on flush
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
if ((int)c >= 32) sender->post(fs, c);
......
......@@ -367,20 +367,20 @@ std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_findFrameset(int64_t ts) {
* Note: Must occur inside a mutex lock.
*/
std::shared_ptr<ftl::data::FrameSet> ForeignBuilder::_getFrameset() {
ftl::data::FrameSetPtr f;
auto i = framesets_.begin();
int N = bufferSize_;
// Skip N frames to fixed buffer location
if (bufferSize_ > 0) {
while (N-- > 0 && i != framesets_.end()) ++i;
// Otherwise skip to first fully completed frame
if (i != framesets_.end()) f = *i;
} 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()) {
auto f = *i;
if (f) {
// Lock to force completion of on going construction first
UNIQUE_LOCK(f->smtx, slk);
last_frame_ = f->timestamp();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment