Determine chunking point

Change-Id: Ic5690f803c1a2c22b80785aefbc1f1cef2f11c38
This commit is contained in:
Kamesh Devarakonda 2017-12-12 11:51:50 -05:00
parent 7e46ad1021
commit 4e3a24fb41
1 changed files with 11 additions and 0 deletions

View File

@ -157,6 +157,17 @@ Status ChunkingHandler::ProcessMediaSample(const MediaSample* sample) {
current_subsegment_index_ = 0; current_subsegment_index_ = 0;
new_segment = true; new_segment = true;
} }
// We use 'while' instead of 'if' to make sure to pop off multiple SCTE35
// events that may be very close to each other.
while (!scte35_events_.empty() &&
(scte35_events_.top()->scte35_event->start_time <= timestamp)) {
if (!new_segment) {
// Reset subsegment index but don't change current_segment_index_.
current_subsegment_index_ = 0;
new_segment = true;
}
scte35_events_.pop();
}
} }
if (!new_segment && subsegment_duration_ > 0 && if (!new_segment && subsegment_duration_ > 0 &&
(is_key_frame || !chunking_params_.subsegment_sap_aligned)) { (is_key_frame || !chunking_params_.subsegment_sap_aligned)) {