Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: media/base/decoder_buffer.h

Issue 11993002: Tighten up media::DecoderBuffer API contract for end of stream buffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/decoder_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/decoder_buffer.h
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h
index 7cb496b119b1158ec58a481170b95365f5ab7300..c23e88f5fcc85820c9c322b9475955329b31711d 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>;
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/decoder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698