Home | History | Annotate | Download | only in base
      1 // Copyright (c) 2012 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 // Timestamps are derived directly from the encoded media file and are commonly
      6 // known as the presentation timestamp (PTS).  Durations are a best-guess and
      7 // are usually derived from the sample/frame rate of the media file.
      8 //
      9 // Due to encoding and transmission errors, it is not guaranteed that timestamps
     10 // arrive in a monotonically increasing order nor that the next timestamp will
     11 // be equal to the previous timestamp plus the duration.
     12 //
     13 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed:
     14 //
     15 //               Buffer0      Buffer1      Buffer2      ...      BufferN
     16 // Timestamp:        0us      40000us      80000us      ...   (N*40000)us
     17 // Duration*:    40000us      40000us      40000us      ...       40000us
     18 //
     19 //  *25fps = 0.04s per frame = 40000us per frame
     20 
     21 #ifndef MEDIA_BASE_BUFFERS_H_
     22 #define MEDIA_BASE_BUFFERS_H_
     23 
     24 #include "base/basictypes.h"
     25 #include "base/memory/ref_counted.h"
     26 #include "base/time/time.h"
     27 #include "media/base/media_export.h"
     28 
     29 namespace media {
     30 
     31 // TODO(scherkus): Move the contents of this file elsewhere.
     32 
     33 // Indicates an invalid or missing timestamp.
     34 MEDIA_EXPORT extern inline base::TimeDelta kNoTimestamp() {
     35   return base::TimeDelta::FromMicroseconds(kint64min);
     36 }
     37 
     38 // Represents an infinite stream duration.
     39 MEDIA_EXPORT extern inline base::TimeDelta kInfiniteDuration() {
     40   return base::TimeDelta::FromMicroseconds(kint64max);
     41 }
     42 
     43 }  // namespace media
     44 
     45 #endif  // MEDIA_BASE_BUFFERS_H_
     46