OLD | NEW |
---|---|
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/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 last_appended_buffer_timestamp_(kNoTimestamp()), | 343 last_appended_buffer_timestamp_(kNoTimestamp()), |
344 last_appended_buffer_is_keyframe_(false), | 344 last_appended_buffer_is_keyframe_(false), |
345 last_output_buffer_timestamp_(kNoTimestamp()), | 345 last_output_buffer_timestamp_(kNoTimestamp()), |
346 max_interbuffer_distance_(kNoTimestamp()), | 346 max_interbuffer_distance_(kNoTimestamp()), |
347 memory_limit_(kDefaultVideoMemoryLimit), | 347 memory_limit_(kDefaultVideoMemoryLimit), |
348 config_change_pending_(false) { | 348 config_change_pending_(false) { |
349 DCHECK(video_config.IsValidConfig()); | 349 DCHECK(video_config.IsValidConfig()); |
350 video_configs_.push_back(video_config); | 350 video_configs_.push_back(video_config); |
351 } | 351 } |
352 | 352 |
353 SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config, | |
354 const LogCB& log_cb) | |
355 : log_cb_(log_cb), | |
356 current_config_index_(0), | |
357 append_config_index_(0), | |
358 seek_pending_(false), | |
359 end_of_stream_(false), | |
360 seek_buffer_timestamp_(kNoTimestamp()), | |
361 selected_range_(NULL), | |
362 media_segment_start_time_(kNoTimestamp()), | |
363 range_for_next_append_(ranges_.end()), | |
364 new_media_segment_(false), | |
365 last_appended_buffer_timestamp_(kNoTimestamp()), | |
366 last_appended_buffer_is_keyframe_(false), | |
367 last_output_buffer_timestamp_(kNoTimestamp()), | |
368 max_interbuffer_distance_(kNoTimestamp()), | |
369 memory_limit_(kDefaultAudioMemoryLimit), | |
370 config_change_pending_(false) { | |
371 text_track_config_ = text_config; | |
acolwell GONE FROM CHROMIUM
2013/10/24 18:57:51
nit: Please put this in the initializer list above
Matthew Heaney (Chromium)
2013/10/25 03:05:38
Done.
| |
372 } | |
373 | |
353 SourceBufferStream::~SourceBufferStream() { | 374 SourceBufferStream::~SourceBufferStream() { |
354 while (!ranges_.empty()) { | 375 while (!ranges_.empty()) { |
355 delete ranges_.front(); | 376 delete ranges_.front(); |
356 ranges_.pop_front(); | 377 ranges_.pop_front(); |
357 } | 378 } |
358 } | 379 } |
359 | 380 |
360 void SourceBufferStream::OnNewMediaSegment( | 381 void SourceBufferStream::OnNewMediaSegment( |
361 base::TimeDelta media_segment_start_time) { | 382 base::TimeDelta media_segment_start_time) { |
362 DCHECK(!end_of_stream_); | 383 DCHECK(!end_of_stream_); |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1215 CompleteConfigChange(); | 1236 CompleteConfigChange(); |
1216 return audio_configs_[current_config_index_]; | 1237 return audio_configs_[current_config_index_]; |
1217 } | 1238 } |
1218 | 1239 |
1219 const VideoDecoderConfig& SourceBufferStream::GetCurrentVideoDecoderConfig() { | 1240 const VideoDecoderConfig& SourceBufferStream::GetCurrentVideoDecoderConfig() { |
1220 if (config_change_pending_) | 1241 if (config_change_pending_) |
1221 CompleteConfigChange(); | 1242 CompleteConfigChange(); |
1222 return video_configs_[current_config_index_]; | 1243 return video_configs_[current_config_index_]; |
1223 } | 1244 } |
1224 | 1245 |
1246 const TextTrackConfig& SourceBufferStream::GetCurrentTextTrackConfig() { | |
1247 return text_track_config_; | |
1248 } | |
1249 | |
1225 base::TimeDelta SourceBufferStream::GetMaxInterbufferDistance() const { | 1250 base::TimeDelta SourceBufferStream::GetMaxInterbufferDistance() const { |
1226 if (max_interbuffer_distance_ == kNoTimestamp()) | 1251 if (max_interbuffer_distance_ == kNoTimestamp()) |
1227 return base::TimeDelta::FromMilliseconds(kDefaultBufferDurationInMs); | 1252 return base::TimeDelta::FromMilliseconds(kDefaultBufferDurationInMs); |
1228 return max_interbuffer_distance_; | 1253 return max_interbuffer_distance_; |
1229 } | 1254 } |
1230 | 1255 |
1231 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { | 1256 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
1232 DCHECK(!audio_configs_.empty()); | 1257 DCHECK(!audio_configs_.empty()); |
1233 DCHECK(video_configs_.empty()); | 1258 DCHECK(video_configs_.empty()); |
1234 DVLOG(3) << "UpdateAudioConfig."; | 1259 DVLOG(3) << "UpdateAudioConfig."; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1949 return ComputeFudgeRoom(GetApproximateDuration()); | 1974 return ComputeFudgeRoom(GetApproximateDuration()); |
1950 } | 1975 } |
1951 | 1976 |
1952 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1977 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1953 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1978 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1954 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1979 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1955 return max_interbuffer_distance; | 1980 return max_interbuffer_distance; |
1956 } | 1981 } |
1957 | 1982 |
1958 } // namespace media | 1983 } // namespace media |
OLD | NEW |