OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ | 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ |
6 #define MEDIA_BASE_DECODER_BUFFER_H_ | 6 #define MEDIA_BASE_DECODER_BUFFER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/aligned_memory.h" | 12 #include "base/memory/aligned_memory.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "media/base/buffers.h" | |
17 #include "media/base/decrypt_config.h" | 18 #include "media/base/decrypt_config.h" |
18 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
22 // A specialized buffer for interfacing with audio / video decoders. | 23 // A specialized buffer for interfacing with audio / video decoders. |
23 // | 24 // |
24 // Specifically ensures that data is aligned and padded as necessary by the | 25 // Specifically ensures that data is aligned and padded as necessary by the |
25 // underlying decoding framework. On desktop platforms this means memory is | 26 // underlying decoding framework. On desktop platforms this means memory is |
26 // allocated using FFmpeg with particular alignment and padding requirements. | 27 // allocated using FFmpeg with particular alignment and padding requirements. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 // shave keep as a virtual with hacker_style() for now. | 71 // shave keep as a virtual with hacker_style() for now. |
71 virtual void set_timestamp(base::TimeDelta timestamp); | 72 virtual void set_timestamp(base::TimeDelta timestamp); |
72 | 73 |
73 base::TimeDelta duration() const { | 74 base::TimeDelta duration() const { |
74 DCHECK(!end_of_stream()); | 75 DCHECK(!end_of_stream()); |
75 return duration_; | 76 return duration_; |
76 } | 77 } |
77 | 78 |
78 void set_duration(base::TimeDelta duration) { | 79 void set_duration(base::TimeDelta duration) { |
79 DCHECK(!end_of_stream()); | 80 DCHECK(!end_of_stream()); |
81 DCHECK(duration == kNoTimestamp() || duration >= base::TimeDelta()) | |
82 << duration.InSecondsF(); | |
wolenetz
2014/07/09 22:42:16
nit: disallow kInfiniteDuration() buffer duration?
acolwell GONE FROM CHROMIUM
2014/07/15 18:49:26
Done.
| |
80 duration_ = duration; | 83 duration_ = duration; |
81 } | 84 } |
82 | 85 |
83 const uint8* data() const { | 86 const uint8* data() const { |
84 DCHECK(!end_of_stream()); | 87 DCHECK(!end_of_stream()); |
85 return data_.get(); | 88 return data_.get(); |
86 } | 89 } |
87 | 90 |
88 uint8* writable_data() const { | 91 uint8* writable_data() const { |
89 DCHECK(!end_of_stream()); | 92 DCHECK(!end_of_stream()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 | 180 |
178 // Constructor helper method for memory allocations. | 181 // Constructor helper method for memory allocations. |
179 void Initialize(); | 182 void Initialize(); |
180 | 183 |
181 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 184 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
182 }; | 185 }; |
183 | 186 |
184 } // namespace media | 187 } // namespace media |
185 | 188 |
186 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 189 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |