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]);
|
"Could not parse start time, -->, and end time from " + block[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// According to the WebVTT spec
|
// According to the WebVTT spec end time must be greater than the start time
|
||||||
// (https://www.w3.org/TR/webvtt1/#webvtt-cue-timings) end time must be
|
// of the cue. Since we are seeing content with invalid times in the field, we
|
||||||
// greater than the start time of the cue. Since we are seeing content with
|
// are going to drop the cue instead of failing to package.
|
||||||
// zero-duration cues 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
|
// Print a warning so that those packaging content can know that their
|
||||||
// content is not spec compliant.
|
// content is not spec compliant.
|
||||||
if (start_time == end_time) {
|
if (end_time <= start_time) {
|
||||||
LOG(WARNING) << "WebVTT input is not spec compliant."
|
LOG(WARNING) << "WebVTT input is not spec compliant. Start time ("
|
||||||
" Skipping zero-duration cue\n"
|
<< start_time << ") should be less than end time (" << end_time
|
||||||
|
<< "). Skipping webvtt cue:"
|
||||||
<< BlockToString(block, block_size);
|
<< BlockToString(block, block_size);
|
||||||
|
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
|
|
Loading…
Reference in New Issue