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 #include "media/base/decoder_buffer.h" | 5 #include "media/base/decoder_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 #include "media/base/decrypt_config.h" | 9 #include "media/base/decrypt_config.h" |
10 | 10 |
11 namespace media { | 11 namespace media { |
12 | 12 |
13 DecoderBuffer::DecoderBuffer(int size) | 13 DecoderBuffer::DecoderBuffer(int size) |
14 : size_(size), | 14 : size_(size), |
15 side_data_size_(0) { | 15 side_data_size_(0), |
| 16 is_key_frame_(false) { |
16 Initialize(); | 17 Initialize(); |
17 } | 18 } |
18 | 19 |
19 DecoderBuffer::DecoderBuffer(const uint8* data, int size, | 20 DecoderBuffer::DecoderBuffer(const uint8* data, int size, |
20 const uint8* side_data, int side_data_size) | 21 const uint8* side_data, int side_data_size) |
21 : size_(size), | 22 : size_(size), |
22 side_data_size_(side_data_size) { | 23 side_data_size_(side_data_size), |
| 24 is_key_frame_(false) { |
23 if (!data) { | 25 if (!data) { |
24 CHECK_EQ(size_, 0); | 26 CHECK_EQ(size_, 0); |
25 CHECK(!side_data); | 27 CHECK(!side_data); |
26 return; | 28 return; |
27 } | 29 } |
28 | 30 |
29 Initialize(); | 31 Initialize(); |
30 memcpy(data_.get(), data, size_); | 32 memcpy(data_.get(), data, size_); |
31 if (side_data) | 33 if (side_data) |
32 memcpy(side_data_.get(), side_data, side_data_size_); | 34 memcpy(side_data_.get(), side_data, side_data_size_); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 std::string DecoderBuffer::AsHumanReadableString() { | 77 std::string DecoderBuffer::AsHumanReadableString() { |
76 if (end_of_stream()) { | 78 if (end_of_stream()) { |
77 return "end of stream"; | 79 return "end of stream"; |
78 } | 80 } |
79 | 81 |
80 std::ostringstream s; | 82 std::ostringstream s; |
81 s << "timestamp: " << timestamp_.InMicroseconds() | 83 s << "timestamp: " << timestamp_.InMicroseconds() |
82 << " duration: " << duration_.InMicroseconds() | 84 << " duration: " << duration_.InMicroseconds() |
83 << " size: " << size_ | 85 << " size: " << size_ |
84 << " side_data_size: " << side_data_size_ | 86 << " side_data_size: " << side_data_size_ |
| 87 << " is_key_frame: " << is_key_frame_ |
85 << " encrypted: " << (decrypt_config_ != NULL) | 88 << " encrypted: " << (decrypt_config_ != NULL) |
86 << " discard_padding (ms): (" << discard_padding_.first.InMilliseconds() | 89 << " discard_padding (ms): (" << discard_padding_.first.InMilliseconds() |
87 << ", " << discard_padding_.second.InMilliseconds() << ")"; | 90 << ", " << discard_padding_.second.InMilliseconds() << ")"; |
88 return s.str(); | 91 return s.str(); |
89 } | 92 } |
90 | 93 |
91 void DecoderBuffer::set_timestamp(base::TimeDelta timestamp) { | 94 void DecoderBuffer::set_timestamp(base::TimeDelta timestamp) { |
92 DCHECK(!end_of_stream()); | 95 DCHECK(!end_of_stream()); |
93 timestamp_ = timestamp; | 96 timestamp_ = timestamp; |
94 } | 97 } |
95 | 98 |
96 } // namespace media | 99 } // namespace media |
OLD | NEW |