diff --git a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd index 8963d219a2..7afe2db741 100644 --- a/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-opus-vp9-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-320x240-vorbis-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vorbis-webm-golden.mpd index 8f8784be96..2a8207ce8f 100644 --- a/packager/app/test/testdata/bear-320x240-vorbis-webm-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-vorbis-webm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd index efeacb525d..e076235af7 100644 --- a/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd +++ b/packager/app/test/testdata/bear-320x240-vp9-opus-webm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd index d16ca12b0e..343e19815b 100644 --- a/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-a-clear-v-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-aac_he-silent_right-golden.mpd b/packager/app/test/testdata/bear-640x360-aac_he-silent_right-golden.mpd index 5994c47f3b..26994a4b6b 100644 --- a/packager/app/test/testdata/bear-640x360-aac_he-silent_right-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-aac_he-silent_right-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd index af910e8eed..95f82e1034 100644 --- a/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cbc1-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd index b2a8da16b4..be8c59ecc9 100644 --- a/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cbcs-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd index 719a8e2c38..4a943da447 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-ad_cues-golden.mpd @@ -1,6 +1,6 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd index 45915bf2a6..d53ce856cc 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd index 2c332d628b..3fc1016025 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-no-clear-lead-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd index c9e3e7458d..3fd3a0c4a8 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-no-pssh-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd index 2f3145c34c..5a14de9678 100644 --- a/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cenc-non-iop-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd index 4f363d82ba..8280a41d19 100644 --- a/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-cens-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-golden.mpd b/packager/app/test/testdata/bear-640x360-av-golden.mpd index 81bbf4f594..7ca5c607af 100644 --- a/packager/app/test/testdata/bear-640x360-av-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd index 2a43303cfd..4cd8f2669c 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-static-ad_cues-golden.mpd @@ -1,6 +1,6 @@ - + @@ -24,7 +24,7 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd index b29a49ff9a..377d854878 100644 --- a/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-live-static-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd b/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd index 2b5041c5f8..641a9c4b2f 100644 --- a/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-por-BR-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-por-golden.mpd b/packager/app/test/testdata/bear-640x360-av-por-golden.mpd index 2b5041c5f8..641a9c4b2f 100644 --- a/packager/app/test/testdata/bear-640x360-av-por-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-por-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd index 3980468707..3b1204aa54 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd index 47002fcf88..9bd9928649 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd index d0dda4b1cd..d1d8946925 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd index 6a5bbe8238..a42099b0ca 100644 --- a/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-av-trick-1-trick-2-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-avt-golden.mpd b/packager/app/test/testdata/bear-640x360-avt-golden.mpd index 0be7c14538..eee7f2db58 100644 --- a/packager/app/test/testdata/bear-640x360-avt-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-avt-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd index 09fc89ed78..b8cf07df80 100644 --- a/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-hevc-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-v-golden.mpd b/packager/app/test/testdata/bear-640x360-v-golden.mpd index c78e29d393..b9db914379 100644 --- a/packager/app/test/testdata/bear-640x360-v-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-v-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd index 108e3c3a47..c16081d09c 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd index 0354738a2d..2aea967717 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-cenc-webm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd index f177a945ff..27a9bea604 100644 --- a/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd +++ b/packager/app/test/testdata/bear-640x360-vp8-webm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd index 34da6e83fc..a44577f4b0 100644 --- a/packager/app/test/testdata/bear-avc3-wvm-golden.mpd +++ b/packager/app/test/testdata/bear-avc3-wvm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/app/test/testdata/bear-wvm-golden.mpd b/packager/app/test/testdata/bear-wvm-golden.mpd index e14c797b8e..bb0cd8b4d2 100644 --- a/packager/app/test/testdata/bear-wvm-golden.mpd +++ b/packager/app/test/testdata/bear-wvm-golden.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/mpd/base/mpd_utils.cc b/packager/mpd/base/mpd_utils.cc index a86c7f1c39..049dbd7739 100644 --- a/packager/mpd/base/mpd_utils.cc +++ b/packager/mpd/base/mpd_utils.cc @@ -159,7 +159,12 @@ std::string GetAdaptationSetKey(const MediaInfo& media_info) { } std::string SecondsToXmlDuration(double seconds) { - return "PT" + DoubleToString(seconds) + "S"; + // Chrome internally uses time accurate to microseconds, which is implemented + // per MSE spec (https://www.w3.org/TR/media-source/). + // We need a string formatter that has at least microseconds accuracy for a + // normal video (with duration up to 3 hours). Chrome's DoubleToString + // implementation meets the requirement. + return "PT" + base::DoubleToString(seconds) + "S"; } bool GetDurationAttribute(xmlNodePtr node, float* duration) { @@ -192,14 +197,6 @@ bool OnlyOneTrue(bool b1, bool b2, bool b3) { return !MoreThanOneTrue(b1, b2, b3) && AtLeastOneTrue(b1, b2, b3); } -// Implement our own DoubleToString as base::DoubleToString uses third_party -// library dmg_fp. -std::string DoubleToString(double value) { - std::ostringstream stringstream; - stringstream << value; - return stringstream.str(); -} - // Coverts binary data into human readable UUID format. bool HexToUUID(const std::string& data, std::string* uuid_format) { DCHECK(uuid_format); diff --git a/packager/mpd/base/mpd_utils.h b/packager/mpd/base/mpd_utils.h index 38a26c3cec..02072f1297 100644 --- a/packager/mpd/base/mpd_utils.h +++ b/packager/mpd/base/mpd_utils.h @@ -58,11 +58,6 @@ bool MoreThanOneTrue(bool b1, bool b2, bool b3); bool AtLeastOneTrue(bool b1, bool b2, bool b3); bool OnlyOneTrue(bool b1, bool b2, bool b3); -/// Converts double to string. -/// @param value is the input double data. -/// @return value formatted in string. -std::string DoubleToString(double value); - /// Converts hex data to UUID format. Hex data must be size 16. /// @param data input hex data. /// @param uuid_format is the UUID format of the input. diff --git a/packager/mpd/base/xml/xml_node.cc b/packager/mpd/base/xml/xml_node.cc index 2148c743e7..7844329e12 100644 --- a/packager/mpd/base/xml/xml_node.cc +++ b/packager/mpd/base/xml/xml_node.cc @@ -121,7 +121,7 @@ void XmlNode::SetFloatingPointAttribute(const char* attribute_name, DCHECK(node_); DCHECK(attribute_name); xmlSetProp(node_.get(), BAD_CAST attribute_name, - BAD_CAST(DoubleToString(number).c_str())); + BAD_CAST(base::DoubleToString(number).c_str())); } void XmlNode::SetId(uint32_t id) {