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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 10164017: Implement sourceAddId() & sourceRemoveId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style fixes 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
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index d3f532cc9fbb13a601ec18ef57ccef79ed50a859..fe3dc460804e54c6e19e7afc960357288f1d6187 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,10 +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 (!source_id_.empty())
+ return kReachedIdLimit;
+
+ source_id_ = id;
+ return kOk;
+}
+
+bool ChunkDemuxer::RemoveId(const std::string& id) {
+ DCHECK(!source_id_.empty());
+ DCHECK_EQ(source_id_, id);
+ source_id_ = "";
+ return true;
+}
+
+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);
- if (!data || length == 0u)
+ if (id.empty() || !data || length == 0u)
return false;
scherkus (not reviewing) 2012/04/23 19:24:17 documentation states false is returned when in an
acolwell GONE FROM CHROMIUM 2012/04/23 22:15:23 Done.
int64 buffered_bytes = 0;

Powered by Google App Engine
This is Rietveld 408576698