Print Error and Ignore Text Samples With Bad Times
Before we had an assert that would catch if a sample had an invalid times, however input may have bad times. We did have a message if we saw a sample with a duration equal to zero. This expands that check to check if the time is valid in general and will ignore any sample that is not valid. Fixes #425 Change-Id: I9774bfbdbd401f3016d2c345665b9973d1889db7
This commit is contained in:
parent
a1fdc11f3e
commit
a510d3aa38
|
@ -224,17 +224,21 @@ Status WebVttParser::ParseCue(const std::string& id,
|
|||
"Could not parse start time, -->, and end time from " + block[0]);
|
||||
}
|
||||
|
||||
// According to the WebVTT spec
|
||||
// (https://www.w3.org/TR/webvtt1/#webvtt-cue-timings) end time must be
|
||||
// greater than the start time of the cue. Since we are seeing content with
|
||||
// zero-duration cues in the field, we are going to drop the cue instead of
|
||||
// failing to package.
|
||||
// According to the WebVTT spec end time must be greater than the start time
|
||||
// of the cue. Since we are seeing content with invalid times in the field, we
|
||||
// are going to drop the cue instead of failing to package.
|
||||
//
|
||||
// For more context see:
|
||||
// - https://www.w3.org/TR/webvtt1/#webvtt-cue-timings
|
||||
// - https://github.com/google/shaka-packager/issues/335
|
||||
// - https://github.com/google/shaka-packager/issues/425
|
||||
//
|
||||
// Print a warning so that those packaging content can know that their
|
||||
// content is not spec compliant.
|
||||
if (start_time == end_time) {
|
||||
LOG(WARNING) << "WebVTT input is not spec compliant."
|
||||
" Skipping zero-duration cue\n"
|
||||
if (end_time <= start_time) {
|
||||
LOG(WARNING) << "WebVTT input is not spec compliant. Start time ("
|
||||
<< start_time << ") should be less than end time (" << end_time
|
||||
<< "). Skipping webvtt cue:"
|
||||
<< BlockToString(block, block_size);
|
||||
|
||||
return Status::OK;
|
||||
|
|
Loading…
Reference in New Issue