Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: media/formats/webm/webm_info_parser.cc

Issue 231283005: Add live mode detection in WebM MediaSource parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698