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

Side by Side 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: Prevent negative timestamps. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
6 #define MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
7
8 #include "base/basictypes.h"
9 #include "base/macros.h"
10 #include "media/base/media_export.h"
11
12 namespace media {
13 namespace mp2t {
14
15 class MEDIA_EXPORT TimestampUnroller {
16 public:
17 TimestampUnroller();
18 ~TimestampUnroller();
19
20 // Given that |timestamp| is coded using 33 bits (accuracy of MPEG-2 TS
21 // timestamps), GetUnrolledTimestamp returns the corresponding unrolled
22 // timestamp.
23 // The unrolled timestamp is defined by:
24 // |timestamp| + k * (2 ^ 33)
25 // where k is estimated so that the unrolled timestamp is as close as
26 // possible to the previous unrolled timestamp returned by this function
27 // (if this function has not been called before, it will return the timestamp
28 // unmodified).
29 int64 GetUnrolledTimestamp(int64 timestamp);
30
31 // Return the minimum unrolled timestamp seen so far.
32 int64 GetMinUnrolledTimestamp() const {
33 return min_unrolled_timestamp_;
34 }
35
36 // Reset the TimestampUnroller to its initial state.
37 void Reset();
38
39 private:
40 // Indicate whether the value of |previous_unrolled_timestamp_| is valid.
41 bool is_previous_timestamp_valid_;
42
43 // This is the last output of GetUnrolledTimestamp.
44 int64 previous_unrolled_timestamp_;
45
46 int64 min_unrolled_timestamp_;
47
48 DISALLOW_COPY_AND_ASSIGN(TimestampUnroller);
49 };
50
51 } // namespace mp2t
52 } // namespace media
53
54 #endif // MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698