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

Unified Diff: media/webm/webm_cluster_parser.cc

Issue 10803019: Chrome-side implementation of media source timestamp offset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/webm/webm_cluster_parser.cc
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index c5a2fdc598237800758df3d8e88acdefc914cff4..64069a9c075889df7ad3fbc8ff15fce5676b7d2b 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -75,6 +75,14 @@ int WebMClusterParser::Parse(const uint8* buf, int size) {
return result;
}
+void WebMClusterParser::SetTimestampOffset(base::TimeDelta offset) {
+ timestamp_offset_ = offset;
+}
+
+void WebMClusterParser::ClearTimestampOffset() {
+ SetTimestampOffset(base::TimeDelta());
+}
+
WebMParserClient* WebMClusterParser::OnListStart(int id) {
if (id == kWebMIdCluster) {
cluster_timecode_ = -1;
@@ -191,7 +199,8 @@ bool WebMClusterParser::OnBlock(int track_num, int timecode,
last_block_timecode_ = timecode;
base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds(
- (cluster_timecode_ + timecode) * timecode_multiplier_);
+ (cluster_timecode_ + timecode) * timecode_multiplier_) +
+ timestamp_offset_;
// The first bit of the flags is set when the block contains only keyframes.
// http://www.matroska.org/technical/specs/index.html

Powered by Google App Engine
This is Rietveld 408576698