OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/media_source_state.h" | 5 #include "media/filters/media_source_state.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "media/base/media_track.h" | 9 #include "media/base/media_track.h" |
10 #include "media/base/media_tracks.h" | 10 #include "media/base/media_tracks.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 ranges_list.push_back(video_->GetBufferedRanges(duration)); | 304 ranges_list.push_back(video_->GetBufferedRanges(duration)); |
305 | 305 |
306 for (TextStreamMap::const_iterator itr = text_stream_map_.begin(); | 306 for (TextStreamMap::const_iterator itr = text_stream_map_.begin(); |
307 itr != text_stream_map_.end(); ++itr) { | 307 itr != text_stream_map_.end(); ++itr) { |
308 ranges_list.push_back(itr->second->GetBufferedRanges(duration)); | 308 ranges_list.push_back(itr->second->GetBufferedRanges(duration)); |
309 } | 309 } |
310 | 310 |
311 return ComputeRangesIntersection(ranges_list, ended); | 311 return ComputeRangesIntersection(ranges_list, ended); |
312 } | 312 } |
313 | 313 |
| 314 TimeDelta MediaSourceState::GetHighestPresentationTimestamp() const { |
| 315 TimeDelta max_pts; |
| 316 |
| 317 if (audio_) |
| 318 max_pts = std::max(max_pts, audio_->GetHighestPresentationTimestamp()); |
| 319 |
| 320 if (video_) |
| 321 max_pts = std::max(max_pts, video_->GetHighestPresentationTimestamp()); |
| 322 |
| 323 for (TextStreamMap::const_iterator itr = text_stream_map_.begin(); |
| 324 itr != text_stream_map_.end(); ++itr) { |
| 325 max_pts = std::max(max_pts, itr->second->GetHighestPresentationTimestamp()); |
| 326 } |
| 327 |
| 328 return max_pts; |
| 329 } |
| 330 |
314 TimeDelta MediaSourceState::GetMaxBufferedDuration() const { | 331 TimeDelta MediaSourceState::GetMaxBufferedDuration() const { |
315 TimeDelta max_duration; | 332 TimeDelta max_duration; |
316 | 333 |
317 if (audio_) | 334 if (audio_) |
318 max_duration = std::max(max_duration, audio_->GetBufferedDuration()); | 335 max_duration = std::max(max_duration, audio_->GetBufferedDuration()); |
319 | 336 |
320 if (video_) | 337 if (video_) |
321 max_duration = std::max(max_duration, video_->GetBufferedDuration()); | 338 max_duration = std::max(max_duration, video_->GetBufferedDuration()); |
322 | 339 |
323 for (TextStreamMap::const_iterator itr = text_stream_map_.begin(); | 340 for (TextStreamMap::const_iterator itr = text_stream_map_.begin(); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 794 |
778 void MediaSourceState::OnSourceInitDone( | 795 void MediaSourceState::OnSourceInitDone( |
779 const StreamParser::InitParameters& params) { | 796 const StreamParser::InitParameters& params) { |
780 DCHECK_EQ(state_, PENDING_PARSER_INIT); | 797 DCHECK_EQ(state_, PENDING_PARSER_INIT); |
781 state_ = PARSER_INITIALIZED; | 798 state_ = PARSER_INITIALIZED; |
782 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; | 799 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; |
783 base::ResetAndReturn(&init_cb_).Run(params); | 800 base::ResetAndReturn(&init_cb_).Run(params); |
784 } | 801 } |
785 | 802 |
786 } // namespace media | 803 } // namespace media |
OLD | NEW |