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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 220113002: MSE: Pick frame processor in ChunkDemuxer::AddId; prepare unit tests to pick processor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // ChunkDemuxerStreams managed by this object. 131 // ChunkDemuxerStreams managed by this object.
132 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration); 132 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration);
133 133
134 // Returns true if currently parsing a media segment, or false otherwise. 134 // Returns true if currently parsing a media segment, or false otherwise.
135 bool parsing_media_segment() const { return parsing_media_segment_; } 135 bool parsing_media_segment() const { return parsing_media_segment_; }
136 136
137 // Sets |frame_processor_|'s sequence mode to |sequence_mode|. 137 // Sets |frame_processor_|'s sequence mode to |sequence_mode|.
138 void SetSequenceMode(bool sequence_mode); 138 void SetSequenceMode(bool sequence_mode);
139 139
140 // Returns the range of buffered data in this source, capped at |duration|. 140 // Returns the range of buffered data in this source, capped at |duration|.
141 // |ended| - Set to true if end of stream has been signalled and the special 141 // |ended| - Set to true if end of stream has been signaled and the special
142 // end of stream range logic needs to be executed. 142 // end of stream range logic needs to be executed.
143 Ranges<TimeDelta> GetBufferedRanges(TimeDelta duration, bool ended) const; 143 Ranges<TimeDelta> GetBufferedRanges(TimeDelta duration, bool ended) const;
144 144
145 // Returns the highest buffered duration across all streams managed 145 // Returns the highest buffered duration across all streams managed
146 // by this object. 146 // by this object.
147 // Returns TimeDelta() if none of the streams contain buffered data. 147 // Returns TimeDelta() if none of the streams contain buffered data.
148 TimeDelta GetMaxBufferedDuration() const; 148 TimeDelta GetMaxBufferedDuration() const;
149 149
150 // Helper methods that call methods with similar names on all the 150 // Helper methods that call methods with similar names on all the
151 // ChunkDemuxerStreams managed by this object. 151 // ChunkDemuxerStreams managed by this object.
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 SeekAllSources(seek_time); 1099 SeekAllSources(seek_time);
1100 1100
1101 if (seek_cb_.is_null()) { 1101 if (seek_cb_.is_null()) {
1102 cancel_next_seek_ = true; 1102 cancel_next_seek_ = true;
1103 return; 1103 return;
1104 } 1104 }
1105 1105
1106 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); 1106 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
1107 } 1107 }
1108 1108
1109 ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id, 1109 ChunkDemuxer::Status ChunkDemuxer::AddId(
1110 const std::string& type, 1110 const std::string& id,
1111 std::vector<std::string>& codecs) { 1111 const std::string& type,
1112 std::vector<std::string>& codecs,
1113 const bool use_legacy_frame_processor) {
1112 base::AutoLock auto_lock(lock_); 1114 base::AutoLock auto_lock(lock_);
1113 1115
1114 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id)) 1116 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id))
1115 return kReachedIdLimit; 1117 return kReachedIdLimit;
1116 1118
1117 bool has_audio = false; 1119 bool has_audio = false;
1118 bool has_video = false; 1120 bool has_video = false;
1119 scoped_ptr<media::StreamParser> stream_parser( 1121 scoped_ptr<media::StreamParser> stream_parser(
1120 StreamParserFactory::Create(type, codecs, log_cb_, 1122 StreamParserFactory::Create(type, codecs, log_cb_,
1121 &has_audio, &has_video)); 1123 &has_audio, &has_video));
1122 1124
1123 if (!stream_parser) 1125 if (!stream_parser)
1124 return ChunkDemuxer::kNotSupported; 1126 return ChunkDemuxer::kNotSupported;
1125 1127
1126 if ((has_audio && !source_id_audio_.empty()) || 1128 if ((has_audio && !source_id_audio_.empty()) ||
1127 (has_video && !source_id_video_.empty())) 1129 (has_video && !source_id_video_.empty()))
1128 return kReachedIdLimit; 1130 return kReachedIdLimit;
1129 1131
1130 if (has_audio) 1132 if (has_audio)
1131 source_id_audio_ = id; 1133 source_id_audio_ = id;
1132 1134
1133 if (has_video) 1135 if (has_video)
1134 source_id_video_ = id; 1136 source_id_video_ = id;
1135 1137
1138 DCHECK(use_legacy_frame_processor);
acolwell GONE FROM CHROMIUM 2014/04/01 15:55:13 nit: You might want to output a DLOG() message if
wolenetz 2014/04/02 01:43:41 Done.
1139
1136 scoped_ptr<FrameProcessorBase> frame_processor(new LegacyFrameProcessor( 1140 scoped_ptr<FrameProcessorBase> frame_processor(new LegacyFrameProcessor(
1137 base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary, 1141 base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary,
1138 base::Unretained(this)))); 1142 base::Unretained(this))));
1139 1143
1140 scoped_ptr<SourceState> source_state( 1144 scoped_ptr<SourceState> source_state(
1141 new SourceState(stream_parser.Pass(), 1145 new SourceState(stream_parser.Pass(),
1142 frame_processor.Pass(), log_cb_, 1146 frame_processor.Pass(), log_cb_,
1143 base::Bind(&ChunkDemuxer::CreateDemuxerStream, 1147 base::Bind(&ChunkDemuxer::CreateDemuxerStream,
1144 base::Unretained(this)))); 1148 base::Unretained(this))));
1145 1149
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 } 1642 }
1639 1643
1640 void ChunkDemuxer::ShutdownAllStreams() { 1644 void ChunkDemuxer::ShutdownAllStreams() {
1641 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1645 for (SourceStateMap::iterator itr = source_state_map_.begin();
1642 itr != source_state_map_.end(); ++itr) { 1646 itr != source_state_map_.end(); ++itr) {
1643 itr->second->Shutdown(); 1647 itr->second->Shutdown();
1644 } 1648 }
1645 } 1649 }
1646 1650
1647 } // namespace media 1651 } // namespace media
OLDNEW
« 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