summaryrefslogtreecommitdiffstats
path: root/media/base/decoder_buffer.h
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 23:35:59 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 23:35:59 +0000
commitb4c830ae8bcbe9eba8362465db7bd1a64b39716a (patch)
treeb415594733c851cd4d9731b324ef4f5f46998dde /media/base/decoder_buffer.h
parent5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1 (diff)
downloadchromium_src-b4c830ae8bcbe9eba8362465db7bd1a64b39716a.zip
chromium_src-b4c830ae8bcbe9eba8362465db7bd1a64b39716a.tar.gz
chromium_src-b4c830ae8bcbe9eba8362465db7bd1a64b39716a.tar.bz2
Tighten up media::DecoderBuffer API contract for end of stream buffers (round 2).
Folks shouldn't be calling methods on end of stream buffers since the definition is undefined. This time with unit test fixes! TBR=yzshen Review URL: https://chromiumcodereview.appspot.com/11929015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/decoder_buffer.h')
-rw-r--r--media/base/decoder_buffer.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h
index 7cb496b..c23e88f 100644
--- a/media/base/decoder_buffer.h
+++ b/media/base/decoder_buffer.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_BASE_DECODER_BUFFER_H_
#define MEDIA_BASE_DECODER_BUFFER_H_
+#include <string>
+
#include "base/memory/aligned_memory.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -23,6 +25,8 @@ class DecryptConfig;
// allocated using FFmpeg with particular alignment and padding requirements.
//
// Also includes decoder specific functionality for decryption.
+//
+// NOTE: It is illegal to call any method when IsEndOfStream() is true.
class MEDIA_EXPORT DecoderBuffer
: public base::RefCountedThreadSafe<DecoderBuffer> {
public:
@@ -43,8 +47,10 @@ class MEDIA_EXPORT DecoderBuffer
// padded and aligned as necessary. |data| must not be NULL and |size| >= 0.
static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
- // Create a DecoderBuffer indicating we've reached end of stream. GetData()
- // and GetWritableData() will return NULL and GetDataSize() will return 0.
+ // Create a DecoderBuffer indicating we've reached end of stream.
+ //
+ // Calling any method other than IsEndOfStream() on the resulting buffer
+ // is disallowed.
static scoped_refptr<DecoderBuffer> CreateEOSBuffer();
base::TimeDelta GetTimestamp() const;
@@ -64,6 +70,9 @@ class MEDIA_EXPORT DecoderBuffer
// If there's no data in this buffer, it represents end of stream.
bool IsEndOfStream() const;
+ // Returns a human-readable string describing |*this|.
+ std::string AsHumanReadableString();
+
protected:
friend class base::RefCountedThreadSafe<DecoderBuffer>;