| 333 | } |
| 334 | |
| 335 | std::vector<HRD::HRDFrameToRemove> HRD::popRemoveFramesInTimeInterval(time_t from, time_t to) |
| 336 | { |
| 337 | std::vector<HRD::HRDFrameToRemove> l; |
| 338 | auto it = this->framesToRemove.begin(); |
| 339 | double t_r_previous = 0; |
| 340 | while (it != this->framesToRemove.end()) |
| 341 | { |
| 342 | if ((*it).t_r < from) |
| 343 | { |
| 344 | DEBUG_AVC_HRD("Warning: Frame " << (*it).poc << " was not removed at the time (" |
| 345 | << double((*it).t_r) |
| 346 | << ") it should have been. Dropping it now."); |
| 347 | it = this->framesToRemove.erase(it); |
| 348 | continue; |
| 349 | } |
| 350 | if ((*it).t_r < t_r_previous) |
| 351 | { |
| 352 | DEBUG_AVC_HRD("Warning: Frame " << (*it).poc << " has a removal time (" << double((*it).t_r) |
| 353 | << ") before the previous frame (" << t_r_previous |
| 354 | << "). Dropping it now."); |
| 355 | it = this->framesToRemove.erase(it); |
| 356 | continue; |
| 357 | } |
| 358 | if ((*it).t_r >= from && (*it).t_r < to) |
| 359 | { |
| 360 | t_r_previous = (*it).t_r; |
| 361 | l.push_back((*it)); |
| 362 | it = this->framesToRemove.erase(it); |
| 363 | continue; |
| 364 | } |
| 365 | if ((*it).t_r >= to) |
| 366 | break; |
| 367 | // Prevent an infinite loop in case of wrong data. We should never reach this if all timings are |
| 368 | // correct. |
| 369 | it++; |
| 370 | } |
| 371 | return l; |
| 372 | } |
| 373 | |
| 374 | void HRD::addToBufferAndCheck(size_t bufferAdd, |
| 375 | size_t bufferSize, |