Chromium Code Reviews| Index: media/base/encoded_bitstream_buffer.h |
| diff --git a/media/base/encoded_bitstream_buffer.h b/media/base/encoded_bitstream_buffer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48ab0d0d911b37a39801333d8aa6db89c2605825 |
| --- /dev/null |
| +++ b/media/base/encoded_bitstream_buffer.h |
| @@ -0,0 +1,77 @@ |
| +// Copyright (c) 2013 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. |
| + |
| +#ifndef MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |
| +#define MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |
| + |
| +#include <ostream> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/time.h" |
| +#include "media/base/media_export.h" |
| + |
| +namespace media { |
| + |
| +// General encoded video bitstream buffer. |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
This is not a useful comment.
Things that are usef
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| +class MEDIA_EXPORT EncodedBitstreamBuffer : |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
this class looks single threaded. Can you either i
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Shouldn't the ctor take a EncodingMetadata struct
Ville-Mikko Rautio
2013/03/04 14:02:25
It could take EncodingMetadata, I added TODO to re
Ville-Mikko Rautio
2013/03/04 14:02:25
I want this class to be readable concurrently from
|
| + public base::RefCountedThreadSafe<EncodedBitstreamBuffer> { |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Unless you have a good reason for this to be refco
Ville-Mikko Rautio
2013/03/04 14:02:25
The original purpose of this class has been to car
|
| + public: |
| + // Constructor that allocates empty buffer of |size|. |
| + EncodedBitstreamBuffer(size_t size, base::Time timestamp, int temporal_layer); |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
nit: const base::Time&
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
base::Time is just an int64; it's actually more ef
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
In what situation will you want this overload?
Ville-Mikko Rautio
2013/03/04 14:02:25
According to Ami copy is more efficient, going wit
Ville-Mikko Rautio
2013/03/04 14:02:25
I thought that this could be a situation for an so
|
| + // Constructor that copies |size| bytes of data from |buffer| into newly |
| + // allocated buffer. |
| + EncodedBitstreamBuffer(uint8* buffer, |
| + size_t size, |
| + base::Time timestamp, |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
same here
Ville-Mikko Rautio
2013/03/04 14:02:25
According to Ami copy is more efficient, going wit
|
| + int temporal_layer); |
| + |
| + // Accessors for properties. |
| + uint8* buffer() const; |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
nit: we rarely have const methods that provide wri
Ville-Mikko Rautio
2013/03/04 14:02:25
I'll take the full const way to emphasize read-onl
|
| + size_t size() const; |
| + bool key_frame() const; |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
these bool accessors (and members) probably want a
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| + bool altref_frame() const; |
| + bool golden_frame() const; |
| + base::Time timestamp() const; |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
nit: const base::Time& timestamp() const;
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| + int temporal_layer() const; |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
_id ?
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| + bool droppable() const; |
| + bool layer_sync() const; |
| + |
| + // Setters for properties. |
| + void MarkKeyFrame(); |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
s/Mark/Set/ here and below.
Although since they're
Ville-Mikko Rautio
2013/03/04 14:02:25
I'm taking these all down for benefit of the Encod
|
| + void MarkAltRef(); |
| + void MarkGolden(); |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
These make this look like an EncodedVP8BitstreamBu
Ville-Mikko Rautio
2013/03/04 14:02:25
That's right. In fact I had EncodedBitstreamBuffer
|
| + void MarkDroppable(); |
| + void MarkLayerSync(); |
|
holmer
2013/03/04 13:36:40
Can you comment on these properties? In particular
Ville-Mikko Rautio
2013/03/05 13:02:18
I thought these with "is-a" semantics. Does WebRTC
holmer
2013/03/05 13:32:54
But what does it mean that it is an AltRef frame?
vmr
2013/03/06 05:51:29
Sorry, I should have been clearer.
Intention is t
holmer
2013/03/07 14:20:32
Thanks for clarifying.
WebRTC doesn't use it expl
|
| + |
| + protected: |
| + virtual ~EncodedBitstreamBuffer(); // Destructor. Will deallocate the buffers. |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Comment does not add value.
~ means destructor
sco
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| + friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>; |
| + |
| + private: |
| + scoped_ptr<uint8[]> buffer_; |
| + size_t size_; |
| + base::Time timestamp_; |
| + bool key_frame_; |
| + int temporal_layer_; |
| + bool altref_frame_; |
| + bool golden_frame_; |
| + // Determines whether the buffer is droppable. With droppable buffers decoding |
| + // can be skipped without affecting the decoding of subsequent buffers. |
| + bool droppable_; |
| + // For temporal base layer, the field must be set to 0 only if it only depends |
| + // on previous key frame. For temporal enhancement layers the layer sync must |
| + // be set to true, if the buffer depends only on the previous temporal base |
| + // layer buffer. |
| + bool layer_sync_; |
| + DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer); |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Add an empty line before this one?
Ville-Mikko Rautio
2013/03/04 14:02:25
Done.
|
| +}; |
| + |
| +} // namespace media |
| + |
| +// Pretty print operator for the EncodedBitstreamBuffer. |
| +std::ostream& operator<<(std::ostream& output, |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
although chromium uses streams for logging, I beli
Ville-Mikko Rautio
2013/03/04 14:02:25
I know. I just really want to have a way to log th
|
| + const media::EncodedBitstreamBuffer& b); |
| + |
| +#endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |