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

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

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: modified ffmpeg demuxer unittest Created 7 years, 1 month 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
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/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
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 text_track_config_(text_config),
359 seek_pending_(false),
360 end_of_stream_(false),
361 seek_buffer_timestamp_(kNoTimestamp()),
362 selected_range_(NULL),
363 media_segment_start_time_(kNoTimestamp()),
364 range_for_next_append_(ranges_.end()),
365 new_media_segment_(false),
366 last_appended_buffer_timestamp_(kNoTimestamp()),
367 last_appended_buffer_is_keyframe_(false),
368 last_output_buffer_timestamp_(kNoTimestamp()),
369 max_interbuffer_distance_(kNoTimestamp()),
370 memory_limit_(kDefaultAudioMemoryLimit),
371 config_change_pending_(false) {
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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 CompleteConfigChange(); 1240 CompleteConfigChange();
1220 return audio_configs_[current_config_index_]; 1241 return audio_configs_[current_config_index_];
1221 } 1242 }
1222 1243
1223 const VideoDecoderConfig& SourceBufferStream::GetCurrentVideoDecoderConfig() { 1244 const VideoDecoderConfig& SourceBufferStream::GetCurrentVideoDecoderConfig() {
1224 if (config_change_pending_) 1245 if (config_change_pending_)
1225 CompleteConfigChange(); 1246 CompleteConfigChange();
1226 return video_configs_[current_config_index_]; 1247 return video_configs_[current_config_index_];
1227 } 1248 }
1228 1249
1250 const TextTrackConfig& SourceBufferStream::GetCurrentTextTrackConfig() {
1251 return text_track_config_;
1252 }
1253
1229 base::TimeDelta SourceBufferStream::GetMaxInterbufferDistance() const { 1254 base::TimeDelta SourceBufferStream::GetMaxInterbufferDistance() const {
1230 if (max_interbuffer_distance_ == kNoTimestamp()) 1255 if (max_interbuffer_distance_ == kNoTimestamp())
1231 return base::TimeDelta::FromMilliseconds(kDefaultBufferDurationInMs); 1256 return base::TimeDelta::FromMilliseconds(kDefaultBufferDurationInMs);
1232 return max_interbuffer_distance_; 1257 return max_interbuffer_distance_;
1233 } 1258 }
1234 1259
1235 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { 1260 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) {
1236 DCHECK(!audio_configs_.empty()); 1261 DCHECK(!audio_configs_.empty());
1237 DCHECK(video_configs_.empty()); 1262 DCHECK(video_configs_.empty());
1238 DVLOG(3) << "UpdateAudioConfig."; 1263 DVLOG(3) << "UpdateAudioConfig.";
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 return ComputeFudgeRoom(GetApproximateDuration()); 1978 return ComputeFudgeRoom(GetApproximateDuration());
1954 } 1979 }
1955 1980
1956 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { 1981 base::TimeDelta SourceBufferRange::GetApproximateDuration() const {
1957 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); 1982 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run();
1958 DCHECK(max_interbuffer_distance != kNoTimestamp()); 1983 DCHECK(max_interbuffer_distance != kNoTimestamp());
1959 return max_interbuffer_distance; 1984 return max_interbuffer_distance;
1960 } 1985 }
1961 1986
1962 } // namespace media 1987 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698