Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't delay DLS transmission on overlap #13

Open
wants to merge 3 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/odr-padenc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,22 @@ int PadEncoder::EncodeSlide() {
}

int PadEncoder::EncodeLabel() {
// skip insertion, if previous one not yet finished
// delay insertion, if previous one not yet finished
if (pad_packetizer.QueueContainsDG(DLSEncoder::APPTYPE_START)) {
fprintf(stderr, "ODR-PadEnc Warning: skipping label insertion, as previous one still in transmission!\n");
if(!label_warn_shown) {
fprintf(stderr, "ODR-PadEnc Warning: there is a label already in transmission, delaying until the previous one ends.\n");
label_warn_shown = true;
}
return 0;
}
else {
if(label_warn_shown) {
fprintf(stderr, "ODR-PadEnc Previous label ended transmission, sending the new one.\n");
label_warn_shown = false;
}
dls_encoder.encodeLabel(options.dls_files[curr_dls_file], options.item_state_file, options.dl_params);
return 1;
}

return 0;
}


Expand Down Expand Up @@ -533,12 +540,13 @@ int PadEncoder::Encode(PadInterface& intf) {

if (pad_timeline >= next_label_insertion) {
// encode label
result = EncodeLabel();
next_label_insertion += std::chrono::milliseconds(options.label_insertion);
int label_encode_result = 0;
label_encode_result = EncodeLabel();
if(label_encode_result > 0) {
next_label_insertion += std::chrono::milliseconds(options.label_insertion);
}
}
}
if (result)
return result;

// flush one PAD (considering X-PAD output interval)
auto pad = pad_packetizer.GetNextPAD(xpad_interval_counter == 0);
Expand Down
1 change: 1 addition & 0 deletions src/odr-padenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PadEncoder {
SLSEncoder sls_encoder;
SlideStore slides;
bool slides_success;
bool label_warn_shown;
int curr_dls_file;
steady_clock::time_point next_slide;
steady_clock::time_point next_label;
Expand Down