summaryrefslogtreecommitdiffstats
path: root/media/base/stream_parser_buffer.cc
blob: 3c765b1d8ee20239d978d3ec1cd76d717a3caac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2012 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.

#include "media/base/stream_parser_buffer.h"

#include "base/logging.h"

namespace media {

StreamParserBuffer::StreamParserBuffer(const uint8* data, int data_size,
                                       bool is_keyframe)
    : DataBuffer(data, data_size),
      is_keyframe_(is_keyframe) {
}

scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() {
  return make_scoped_refptr(new StreamParserBuffer(NULL, 0, false));
}

scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom(
    const uint8* data, int data_size, bool is_keyframe) {
  return make_scoped_refptr(
      new StreamParserBuffer(data, data_size, is_keyframe));
}

base::TimeDelta StreamParserBuffer::GetEndTimestamp() const {
  DCHECK(GetTimestamp() != kNoTimestamp());
  DCHECK(GetDuration() != kNoTimestamp());
  return GetTimestamp() + GetDuration();
}

}  // namespace media