Fixed Incorrect BOM used in WEBVTT Header

When originally implementing the webvtt parser, there was a
misunderstanding in what the BOM was suppose to be
(https://en.wikipedia.org/wiki/Byte_order_mark). This corrects the
misunderstanding.

Close #397

Change-Id: I250d392db228e5e9b86684614b57adc5d8a4e5fe
This commit is contained in:
Aaron Vaage 2018-05-16 16:17:45 -07:00 committed by KongQun Yang
parent 0af2c5cdcf
commit df6661b93d
2 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ bool WebVttParser::Parse() {
<< "block size should be 1 but was " << block.size() << ".";
return false;
}
if (block[0] != "WEBVTT" && block[0] != "\xFE\xFFWEBVTT") {
if (block[0] != "WEBVTT" && block[0] != "\xEF\xBB\xBFWEBVTT") {
LOG(ERROR) << "Failed to read WEBVTT header - should be WEBVTT but was "
<< block[0];
return false;

View File

@ -81,7 +81,7 @@ TEST_F(WebVttParserTest, ParseOnlyHeader) {
TEST_F(WebVttParserTest, ParseHeaderWithBOM) {
const char* text =
"\xFE\xFFWEBVTT\n"
"\xEF\xBB\xBFWEBVTT\n"
"\n";
ASSERT_NO_FATAL_FAILURE(SetUpAndInitializeGraph(text));