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

Side by Side Diff: webkit/media/webmediaplayer_impl.cc

Issue 10680004: HACK on m21 branch 1180 to avoid flickering of buffered bar by lying. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/media/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 WebMediaPlayer::ReadyState WebMediaPlayerImpl::readyState() const { 467 WebMediaPlayer::ReadyState WebMediaPlayerImpl::readyState() const {
468 DCHECK_EQ(main_loop_, MessageLoop::current()); 468 DCHECK_EQ(main_loop_, MessageLoop::current());
469 return ready_state_; 469 return ready_state_;
470 } 470 }
471 471
472 const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() { 472 const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() {
473 DCHECK_EQ(main_loop_, MessageLoop::current()); 473 DCHECK_EQ(main_loop_, MessageLoop::current());
474 media::Ranges<base::TimeDelta> buffered_time_ranges = 474 media::Ranges<base::TimeDelta> buffered_time_ranges =
475 pipeline_->GetBufferedTimeRanges(); 475 pipeline_->GetBufferedTimeRanges();
476 WebKit::WebTimeRanges web_ranges(buffered_time_ranges.size()); 476
477 for (size_t i = 0; i < buffered_time_ranges.size(); ++i) { 477 // HACK http://crrev.com/143765 was deemed to large to merge to m21, so *only
478 web_ranges[i].start = buffered_time_ranges.start(i).InSecondsF(); 478 // on the 1180 branch* we fake out buffered() to return
479 web_ranges[i].end = buffered_time_ranges.end(i).InSecondsF(); 479 // [0,min(duration, max(currentTime+0.5, buffered.end(lastRange)))).
480 } 480 if (buffered_time_ranges.size() == 0)
481 return buffered_;
482 float fake_end = std::min(duration(), std::max(
483 currentTime() + 0.5f, static_cast<float>(buffered_time_ranges.end(
484 buffered_time_ranges.size() - 1).InSecondsF())));
485 WebKit::WebTimeRanges web_ranges(static_cast<size_t>(1));
scherkus (not reviewing) 2012/06/27 17:52:18 1u doesn't work!? :~(
Ami GONE FROM CHROMIUM 2012/06/27 18:15:19 Nope. The template foo in WebVector tries to trea
486 web_ranges[0].start = 0;
487 web_ranges[0].end = fake_end;
481 buffered_.swap(web_ranges); 488 buffered_.swap(web_ranges);
482 return buffered_; 489 return buffered_;
483 } 490 }
484 491
485 float WebMediaPlayerImpl::maxTimeSeekable() const { 492 float WebMediaPlayerImpl::maxTimeSeekable() const {
486 DCHECK_EQ(main_loop_, MessageLoop::current()); 493 DCHECK_EQ(main_loop_, MessageLoop::current());
487 494
488 // We don't support seeking in streaming media. 495 // We don't support seeking in streaming media.
489 if (proxy_ && proxy_->data_source() && proxy_->data_source()->IsStreaming()) 496 if (proxy_ && proxy_->data_source() && proxy_->data_source()->IsStreaming())
490 return 0.0f; 497 return 0.0f;
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 return audio_source_provider_; 1028 return audio_source_provider_;
1022 } 1029 }
1023 1030
1024 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 1031 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
1025 DCHECK_EQ(main_loop_, MessageLoop::current()); 1032 DCHECK_EQ(main_loop_, MessageLoop::current());
1026 incremented_externally_allocated_memory_ = true; 1033 incremented_externally_allocated_memory_ = true;
1027 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 1034 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
1028 } 1035 }
1029 1036
1030 } // namespace webkit_media 1037 } // namespace webkit_media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698