Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 #include "media/base/encoded_bitstream_buffer.h" | |
| 6 | |
| 7 #include <iomanip> | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #include "base/md5.h" | |
| 11 | |
| 12 namespace media { | |
| 13 | |
| 14 EncodedBitstreamBuffer::EncodedBitstreamBuffer(size_t size, | |
| 15 base::Time timestamp, | |
| 16 int temporal_layer) | |
| 17 : buffer_(new uint8[size]), | |
| 18 size_(size), | |
| 19 timestamp_(timestamp), | |
| 20 key_frame_(false), | |
| 21 temporal_layer_(temporal_layer), | |
| 22 altref_frame_(false), | |
| 23 golden_frame_(false), | |
| 24 droppable_(false), | |
| 25 layer_sync_(false) { | |
| 26 } | |
| 27 | |
| 28 EncodedBitstreamBuffer::EncodedBitstreamBuffer(uint8* buffer, | |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
const uint8* buffer?
Actually, would it make sens
Ville-Mikko Rautio
2013/03/04 14:02:25
In the first instance of using this class the buff
| |
| 29 size_t size, | |
| 30 base::Time timestamp, | |
| 31 int temporal_layer) | |
| 32 : buffer_(new uint8[size]), | |
| 33 size_(size), | |
| 34 timestamp_(timestamp), | |
| 35 key_frame_(false), | |
| 36 temporal_layer_(temporal_layer), | |
| 37 altref_frame_(false), | |
| 38 golden_frame_(false) { | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
what about droppable_/layer_sync_?
This is why we
Ville-Mikko Rautio
2013/03/04 14:02:25
Going for the Metadata.
| |
| 39 memcpy(buffer_.get(), buffer, size); | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
This is crazy, considering the IPC system just mem
Ville-Mikko Rautio
2013/03/14 13:19:20
I'll add TODO as this requires coordination with p
| |
| 40 } | |
| 41 | |
| 42 EncodedBitstreamBuffer::~EncodedBitstreamBuffer() { | |
| 43 } | |
| 44 | |
| 45 uint8* EncodedBitstreamBuffer::buffer() const { | |
| 46 return buffer_.get(); | |
| 47 } | |
| 48 | |
| 49 size_t EncodedBitstreamBuffer::size() const { | |
| 50 return size_; | |
| 51 } | |
| 52 | |
| 53 base::Time EncodedBitstreamBuffer::timestamp() const { | |
| 54 return timestamp_; | |
| 55 } | |
| 56 | |
| 57 int EncodedBitstreamBuffer::temporal_layer() const { | |
| 58 return temporal_layer_; | |
| 59 } | |
| 60 | |
| 61 bool EncodedBitstreamBuffer::key_frame() const { | |
| 62 return key_frame_; | |
| 63 } | |
| 64 | |
| 65 bool EncodedBitstreamBuffer::altref_frame() const { | |
| 66 return altref_frame_; | |
| 67 } | |
| 68 | |
| 69 bool EncodedBitstreamBuffer::golden_frame() const { | |
| 70 return golden_frame_; | |
| 71 } | |
| 72 | |
| 73 bool EncodedBitstreamBuffer::droppable() const { | |
| 74 return droppable_; | |
| 75 } | |
| 76 | |
| 77 bool EncodedBitstreamBuffer::layer_sync() const { | |
| 78 return layer_sync_; | |
| 79 } | |
| 80 | |
| 81 void EncodedBitstreamBuffer::MarkKeyFrame() { | |
| 82 key_frame_ = true; | |
| 83 altref_frame_ = true; | |
| 84 golden_frame_ = true; | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Is this really how VP8 bitstreams work?
Ville-Mikko Rautio
2013/03/04 14:02:25
Yes.
| |
| 85 } | |
| 86 | |
| 87 void EncodedBitstreamBuffer::MarkAltRef() { | |
| 88 altref_frame_ = true; | |
| 89 } | |
| 90 | |
| 91 void EncodedBitstreamBuffer::MarkGolden() { | |
| 92 golden_frame_ = true; | |
| 93 } | |
| 94 | |
| 95 void EncodedBitstreamBuffer::MarkDroppable() { | |
| 96 droppable_ = true; | |
| 97 } | |
| 98 | |
| 99 void EncodedBitstreamBuffer::MarkLayerSync() { | |
| 100 layer_sync_ = true; | |
| 101 } | |
| 102 | |
| 103 } // namespace media | |
| 104 | |
| 105 std::ostream& operator<<(std::ostream& output, | |
| 106 const media::EncodedBitstreamBuffer& b) { | |
| 107 base::MD5Digest digest; | |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
this looks like debug only code, right? Can we ex
Ville-Mikko Rautio
2013/03/04 14:02:25
See the comment on the header.
| |
| 108 output << "["; | |
| 109 if (b.key_frame()) { | |
| 110 output << "I"; | |
| 111 } else { | |
| 112 if (b.golden_frame()) | |
| 113 output << "G"; | |
| 114 if (b.altref_frame()) | |
| 115 output << "A"; | |
| 116 if (b.droppable()) | |
| 117 output << "-"; | |
| 118 if (!b.golden_frame() && !b.altref_frame() && !b.droppable()) | |
| 119 output << "P"; | |
| 120 } | |
| 121 output << "]"; | |
| 122 output << " tl: [" << b.temporal_layer(); | |
| 123 if (b.layer_sync()) | |
| 124 output << "S"; | |
| 125 output << "]"; | |
| 126 output << " time: " << std::setprecision(2) << std::fixed | |
| 127 << b.timestamp().ToDoubleT(); | |
| 128 output << " (" << b.size() << " bytes)"; | |
| 129 base::MD5Sum(b.buffer(), b.size(), &digest); | |
| 130 output << " md5: " << base::MD5DigestToBase16(digest); | |
| 131 return output; | |
| 132 } | |
| 133 | |
| OLD | NEW |