From df6661b93d2fb544712041becb282144397b46b4 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Wed, 16 May 2018 16:17:45 -0700 Subject: [PATCH] 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 --- packager/media/formats/webvtt/webvtt_parser.cc | 2 +- packager/media/formats/webvtt/webvtt_parser_unittest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packager/media/formats/webvtt/webvtt_parser.cc b/packager/media/formats/webvtt/webvtt_parser.cc index 71c9dfcc26..2297f6adb1 100644 --- a/packager/media/formats/webvtt/webvtt_parser.cc +++ b/packager/media/formats/webvtt/webvtt_parser.cc @@ -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; diff --git a/packager/media/formats/webvtt/webvtt_parser_unittest.cc b/packager/media/formats/webvtt/webvtt_parser_unittest.cc index 26a547348e..a25e99bfda 100644 --- a/packager/media/formats/webvtt/webvtt_parser_unittest.cc +++ b/packager/media/formats/webvtt/webvtt_parser_unittest.cc @@ -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));