| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void AdaptiveDemuxerStream::DCheckSanity() { | 160 void AdaptiveDemuxerStream::DCheckSanity() { |
| 161 // We only carry out sanity checks in debug mode. | 161 // We only carry out sanity checks in debug mode. |
| 162 if (!logging::DEBUG_MODE) | 162 if (!logging::DEBUG_MODE) |
| 163 return; | 163 return; |
| 164 DCHECK(streams_[current_stream_index_].get()); | 164 DCHECK(streams_[current_stream_index_].get()); |
| 165 | 165 |
| 166 bool non_null_stream_seen = false; | 166 bool non_null_stream_seen = false; |
| 167 Type type = DemuxerStream::UNKNOWN; | 167 Type type = DemuxerStream::UNKNOWN; |
| 168 const MediaFormat* media_format = NULL; | |
| 169 for (size_t i = 0; i < streams_.size(); ++i) { | 168 for (size_t i = 0; i < streams_.size(); ++i) { |
| 170 if (!streams_[i]) | 169 if (!streams_[i]) |
| 171 continue; | 170 continue; |
| 172 | 171 |
| 173 if (!non_null_stream_seen) { | 172 if (!non_null_stream_seen) { |
| 174 non_null_stream_seen = true; | 173 non_null_stream_seen = true; |
| 175 type = streams_[i]->type(); | 174 type = streams_[i]->type(); |
| 176 media_format = &streams_[i]->media_format(); | |
| 177 } else { | 175 } else { |
| 178 DCHECK_EQ(streams_[i]->type(), type); | 176 DCHECK_EQ(streams_[i]->type(), type); |
| 179 DCHECK(streams_[i]->media_format() == *media_format); | |
| 180 } | 177 } |
| 181 } | 178 } |
| 182 } | 179 } |
| 183 | 180 |
| 184 AdaptiveDemuxerStream::~AdaptiveDemuxerStream() { | 181 AdaptiveDemuxerStream::~AdaptiveDemuxerStream() { |
| 185 base::AutoLock auto_lock(lock_); | 182 base::AutoLock auto_lock(lock_); |
| 186 current_stream_index_ = -1; | 183 current_stream_index_ = -1; |
| 187 streams_.clear(); | 184 streams_.clear(); |
| 188 } | 185 } |
| 189 | 186 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 216 } | 213 } |
| 217 | 214 |
| 218 AVStream* AdaptiveDemuxerStream::GetAVStream() { | 215 AVStream* AdaptiveDemuxerStream::GetAVStream() { |
| 219 return current_stream()->GetAVStream(); | 216 return current_stream()->GetAVStream(); |
| 220 } | 217 } |
| 221 | 218 |
| 222 DemuxerStream::Type AdaptiveDemuxerStream::type() { | 219 DemuxerStream::Type AdaptiveDemuxerStream::type() { |
| 223 return current_stream()->type(); | 220 return current_stream()->type(); |
| 224 } | 221 } |
| 225 | 222 |
| 226 const MediaFormat& AdaptiveDemuxerStream::media_format() { | |
| 227 return current_stream()->media_format(); | |
| 228 } | |
| 229 | |
| 230 void AdaptiveDemuxerStream::EnableBitstreamConverter() { | 223 void AdaptiveDemuxerStream::EnableBitstreamConverter() { |
| 231 { | 224 { |
| 232 base::AutoLock auto_lock(lock_); | 225 base::AutoLock auto_lock(lock_); |
| 233 bitstream_converter_enabled_ = true; | 226 bitstream_converter_enabled_ = true; |
| 234 } | 227 } |
| 235 current_stream()->EnableBitstreamConverter(); | 228 current_stream()->EnableBitstreamConverter(); |
| 236 } | 229 } |
| 237 | 230 |
| 238 void AdaptiveDemuxerStream::OnAdaptiveDemuxerSeek(base::TimeDelta seek_time) { | 231 void AdaptiveDemuxerStream::OnAdaptiveDemuxerSeek(base::TimeDelta seek_time) { |
| 239 base::AutoLock auto_lock(lock_); | 232 base::AutoLock auto_lock(lock_); |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 delete cb; | 1030 delete cb; |
| 1038 return; | 1031 return; |
| 1039 } | 1032 } |
| 1040 DemuxerAccumulator* accumulator = new DemuxerAccumulator( | 1033 DemuxerAccumulator* accumulator = new DemuxerAccumulator( |
| 1041 audio_index, video_index, urls.size(), cb); | 1034 audio_index, video_index, urls.size(), cb); |
| 1042 for (size_t i = 0; i < urls.size(); ++i) | 1035 for (size_t i = 0; i < urls.size(); ++i) |
| 1043 delegate_factory_->Build(urls[i], accumulator->GetNthCallback(i)); | 1036 delegate_factory_->Build(urls[i], accumulator->GetNthCallback(i)); |
| 1044 } | 1037 } |
| 1045 | 1038 |
| 1046 } // namespace media | 1039 } // namespace media |
| OLD | NEW |