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

Unified Diff: media/formats/mp2t/timestamp_unroller.h

Issue 539343002: Make the timestamp unroll offset consistent accross PES pids. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CR comments from patch set #8. Created 6 years, 3 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
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp2t/timestamp_unroller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/timestamp_unroller.h
diff --git a/media/formats/mp2t/timestamp_unroller.h b/media/formats/mp2t/timestamp_unroller.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d05b7ceac76a45f8d815851a7ca96f7772071b8
--- /dev/null
+++ b/media/formats/mp2t/timestamp_unroller.h
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
+#define MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
+
+#include "base/basictypes.h"
+#include "base/macros.h"
+#include "media/base/media_export.h"
+
+namespace media {
+namespace mp2t {
+
+class MEDIA_EXPORT TimestampUnroller {
+ public:
+ TimestampUnroller();
+ ~TimestampUnroller();
+
+ // Given that |timestamp| is coded using 33 bits (accuracy of MPEG-2 TS
+ // timestamps), GetUnrolledTimestamp returns the corresponding unrolled
+ // timestamp.
+ // The unrolled timestamp is defined by:
+ // |timestamp| + k * (2 ^ 33)
+ // where k is estimated so that the unrolled timestamp is as close as
+ // possible to the previous unrolled timestamp returned by this function
+ // (if this function has not been called before, it will return the timestamp
+ // unmodified).
+ int64 GetUnrolledTimestamp(int64 timestamp);
+
+ // Reset the TimestampUnroller to its initial state.
+ void Reset();
+
+ private:
+ // Indicate whether the value of |previous_unrolled_timestamp_| is valid.
+ bool is_previous_timestamp_valid_;
+
+ // This is the last output of GetUnrolledTimestamp.
+ int64 previous_unrolled_timestamp_;
+
+ DISALLOW_COPY_AND_ASSIGN(TimestampUnroller);
+};
+
+} // namespace mp2t
+} // namespace media
+
+#endif // MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp2t/timestamp_unroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698