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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 10164017: Implement sourceAddId() & sourceRemoveId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments Created 8 years, 8 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/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index d3f532cc9fbb13a601ec18ef57ccef79ed50a859..25bc0bc0251c6b05f31eea623f6b53bd75a8583a 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -15,6 +15,9 @@
namespace media {
+// TODO(acolwell): Remove this when fixing http://crbug.com/122909 .
+const char* kDefaultSourceType = "video/webm; codecs=\"vp8, vorbis\"";
+
// Create an "end of stream" buffer.
static Buffer* CreateEOSBuffer() {
return new DataBuffer(0);
@@ -455,11 +458,40 @@ void ChunkDemuxer::FlushData() {
ChangeState_Locked(INITIALIZED);
}
-bool ChunkDemuxer::AppendData(const uint8* data, size_t length) {
- DVLOG(1) << "AppendData(" << length << ")";
+ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
+ const std::string& type) {
+ // TODO(acolwell): Proper mimetype decoding and support for more than one ID
+ // will be added as part of http://crbug.com/122909
+ if (type != kDefaultSourceType)
+ return kNotSupported;
- if (!data || length == 0u)
- return false;
+ if (!source_id_.empty())
+ return kReachedIdLimit;
+
+ source_id_ = id;
+ return kOk;
+}
+
+void ChunkDemuxer::RemoveId(const std::string& id) {
+ CHECK(!source_id_.empty());
+ CHECK_EQ(source_id_, id);
+ source_id_ = "";
+}
+
+bool ChunkDemuxer::AppendData(const std::string& id,
+ const uint8* data,
+ size_t length) {
+ DVLOG(1) << "AppendData(" << id << ", " << length << ")";
+
+ // TODO(acolwell): Remove when http://webk.it/83788 fix lands.
+ if (source_id_.empty())
+ AddId(id, kDefaultSourceType);
+
+ DCHECK(!source_id_.empty());
+ DCHECK_EQ(source_id_, id);
+ DCHECK(!id.empty());
+ DCHECK(data);
+ DCHECK_GT(length, 0u);
int64 buffered_bytes = 0;
base::TimeDelta buffered_ts = base::TimeDelta::FromSeconds(-1);
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698