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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase 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
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 1302aa531a87e405aafd14d75a96ae3bf1001e48..70b1b346b633082939ccb3b08818597f5cc0583f 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& s : audio_streams_)
+ result.push_back(s.get());
- if (type == DemuxerStream::VIDEO)
- for (const auto& s : video_streams_)
- if (s->enabled())
- return s.get();
+ for (const auto& s : video_streams_)
+ result.push_back(s.get());
xhwang 2017/02/01 18:26:03 ditto: Are we also pushing disabled streams here?
- return NULL;
+ return result;
+}
+
+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 {

Powered by Google App Engine
This is Rietveld 408576698