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

Unified Diff: media/base/decoder_buffer.cc

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/decoder_buffer.h ('k') | media/base/stream_parser_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/decoder_buffer.cc
diff --git a/media/base/decoder_buffer.cc b/media/base/decoder_buffer.cc
index a07ffac72c749fe9714a0c35dd5bb3fa1e8f7ae1..03f9bbbc566abc70abb878bc0dc00b34c82b7093 100644
--- a/media/base/decoder_buffer.cc
+++ b/media/base/decoder_buffer.cc
@@ -48,38 +48,47 @@ scoped_refptr<DecoderBuffer> DecoderBuffer::CreateEOSBuffer() {
}
base::TimeDelta DecoderBuffer::GetTimestamp() const {
+ DCHECK(!IsEndOfStream());
return timestamp_;
}
void DecoderBuffer::SetTimestamp(const base::TimeDelta& timestamp) {
+ DCHECK(!IsEndOfStream());
timestamp_ = timestamp;
}
base::TimeDelta DecoderBuffer::GetDuration() const {
+ DCHECK(!IsEndOfStream());
return duration_;
}
void DecoderBuffer::SetDuration(const base::TimeDelta& duration) {
+ DCHECK(!IsEndOfStream());
duration_ = duration;
}
const uint8* DecoderBuffer::GetData() const {
+ DCHECK(!IsEndOfStream());
return data_.get();
}
uint8* DecoderBuffer::GetWritableData() const {
+ DCHECK(!IsEndOfStream());
return data_.get();
}
int DecoderBuffer::GetDataSize() const {
+ DCHECK(!IsEndOfStream());
return size_;
}
const DecryptConfig* DecoderBuffer::GetDecryptConfig() const {
+ DCHECK(!IsEndOfStream());
return decrypt_config_.get();
}
void DecoderBuffer::SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config) {
+ DCHECK(!IsEndOfStream());
decrypt_config_ = decrypt_config.Pass();
}
@@ -87,4 +96,17 @@ bool DecoderBuffer::IsEndOfStream() const {
return data_ == NULL;
}
+std::string DecoderBuffer::AsHumanReadableString() {
+ if (IsEndOfStream()) {
+ return "end of stream";
+ }
+
+ std::ostringstream s;
+ s << "timestamp: " << timestamp_.InMicroseconds()
+ << " duration: " << duration_.InMicroseconds()
+ << " size: " << size_
+ << " encrypted: " << (decrypt_config_ != NULL);
+ return s.str();
+}
+
} // namespace media
« no previous file with comments | « media/base/decoder_buffer.h ('k') | media/base/stream_parser_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698