| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 if (pending_seek_) { | 1243 if (pending_seek_) { |
| 1244 seek_time_ = pending_seek_time_; | 1244 seek_time_ = pending_seek_time_; |
| 1245 pending_seek_ = false; | 1245 pending_seek_ = false; |
| 1246 pending_seek_time_ = base::TimeDelta(); | 1246 pending_seek_time_ = base::TimeDelta(); |
| 1247 } | 1247 } |
| 1248 time_changed = true; | 1248 time_changed = true; |
| 1249 } else { | 1249 } else { |
| 1250 // It is safe to call GetCurrentFrameTimestamp() because VFC is stopped | 1250 // It is safe to call GetCurrentFrameTimestamp() because VFC is stopped |
| 1251 // during Suspend(). It won't be started again until after Resume() is | 1251 // during Suspend(). It won't be started again until after Resume() is |
| 1252 // called. Use the pipeline time if there's no video. | 1252 // called. Use the pipeline time if there's no video. |
| 1253 seek_time_ = hasVideo() ? compositor_->GetCurrentFrameTimestamp() | 1253 if (!data_source_ || !data_source_->IsStreaming()) { |
| 1254 : pipeline_.GetMediaTime(); | 1254 seek_time_ = hasVideo() ? compositor_->GetCurrentFrameTimestamp() |
| 1255 : pipeline_.GetMediaTime(); |
| 1256 } else { |
| 1257 // Resume from zero if a resource does not support range requests; this |
| 1258 // avoids a painful "read-the-whole-file" seek penalty. |
| 1259 seek_time_ = base::TimeDelta(); |
| 1260 } |
| 1255 } | 1261 } |
| 1256 | 1262 |
| 1257 if (chunk_demuxer_) | 1263 if (chunk_demuxer_) |
| 1258 chunk_demuxer_->StartWaitingForSeek(seek_time_); | 1264 chunk_demuxer_->StartWaitingForSeek(seek_time_); |
| 1259 | 1265 |
| 1260 resuming_ = true; | 1266 resuming_ = true; |
| 1261 pipeline_.Resume(CreateRenderer(), seek_time_, | 1267 pipeline_.Resume(CreateRenderer(), seek_time_, |
| 1262 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, | 1268 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, |
| 1263 time_changed)); | 1269 time_changed)); |
| 1264 } | 1270 } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1621 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1616 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1622 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1617 << ", Demuxer: " << demuxer_memory_usage; | 1623 << ", Demuxer: " << demuxer_memory_usage; |
| 1618 | 1624 |
| 1619 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1625 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1620 last_reported_memory_usage_ = current_memory_usage; | 1626 last_reported_memory_usage_ = current_memory_usage; |
| 1621 adjust_allocated_memory_cb_.Run(delta); | 1627 adjust_allocated_memory_cb_.Run(delta); |
| 1622 } | 1628 } |
| 1623 | 1629 |
| 1624 } // namespace media | 1630 } // namespace media |
| OLD | NEW |