Index: media/formats/webm/webm_info_parser.cc |
diff --git a/media/formats/webm/webm_info_parser.cc b/media/formats/webm/webm_info_parser.cc |
index ac4f08c40469f14f20136e4f42fe583268d95495..5a2955dbee09a17ca91197ff0d846a714bdda37d 100644 |
--- a/media/formats/webm/webm_info_parser.cc |
+++ b/media/formats/webm/webm_info_parser.cc |
@@ -74,6 +74,28 @@ bool WebMInfoParser::OnFloat(int id, double val) { |
} |
bool WebMInfoParser::OnBinary(int id, const uint8* data, int size) { |
+ if (id == kWebMIdDateUTC) { |
+ const int kDateUTCSize = 8; |
+ if (size != kDateUTCSize) { |
+ DVLOG(1) << "Invalid DateUTC size: " << size; |
+ return false; |
+ } |
+ |
+ // Parse 64-bit big-endian integer. |
+ int64 date_value = 0; |
+ for (int i = 0; i < kDateUTCSize; ++i) { |
+ date_value = (date_value << 8) | data[i]; |
+ } |
+ |
+ // DateUTC is specified in nanoseconds from 0:00 on January 1st, 2001. |
+ base::Time::Exploded millennium_exploded; |
+ memset(&millennium_exploded, 0, sizeof(millennium_exploded)); |
+ millennium_exploded.year = 2001; |
+ millennium_exploded.month = 1; |
+ millennium_exploded.day_of_month = 1; |
+ date_utc_ = base::Time::FromUTCExploded(millennium_exploded) + |
+ base::TimeDelta::FromMicroseconds(date_value / 1000LL); |
+ } |
return true; |
} |