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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 2667283002: Refactor MediaResource to be multi-stream capable (Closed)
Patch Set: Created 3 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/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 1302aa531a87e405aafd14d75a96ae3bf1001e48..47b41b14e8d6cdd91f4d6cb931b4c5fa4c604236 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -308,7 +308,7 @@ void ChunkDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) {
StreamParserBuffer::CreateEOSBuffer());
}
if (!stream_status_change_cb_.is_null())
- stream_status_change_cb_.Run(is_enabled_, timestamp);
+ stream_status_change_cb_.Run(this, is_enabled_, timestamp);
}
void ChunkDemuxerStream::SetStreamStatusChangeCB(
@@ -491,26 +491,25 @@ base::Time ChunkDemuxer::GetTimelineOffset() const {
return timeline_offset_;
}
-DemuxerStream* ChunkDemuxer::GetStream(DemuxerStream::Type type) {
- DCHECK_NE(type, DemuxerStream::TEXT);
+std::vector<DemuxerStream*> ChunkDemuxer::GetStreams() {
base::AutoLock auto_lock(lock_);
- // TODO(servolk): For now return only the first enabled audio/video stream,
- // since this GetStream method is part of the implementation of the
- // DemuxerStreamProvider interface that is used in many places and can't be
- // changed easily. It will be fixed later, when we add support for multiple
- // streams/tracks in DemuxerStreamProvider, tracked by crbug.com/646669
- if (type == DemuxerStream::AUDIO)
- for (const auto& s : audio_streams_)
- if (s->enabled())
- return s.get();
+ std::vector<DemuxerStream*> result;
+ for (const auto& stream : audio_streams_)
+ result.push_back(stream.get());
- if (type == DemuxerStream::VIDEO)
- for (const auto& s : video_streams_)
- if (s->enabled())
- return s.get();
+ for (const auto& stream : video_streams_)
+ result.push_back(stream.get());
+
+ return result;
+}
- return NULL;
+void ChunkDemuxer::SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) {
+ DCHECK(!cb.is_null());
+ for (const auto& s : audio_streams_)
+ s->SetStreamStatusChangeCB(cb);
+ for (const auto& s : video_streams_)
+ s->SetStreamStatusChangeCB(cb);
}
TimeDelta ChunkDemuxer::GetStartTime() const {
« 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