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

Side by Side Diff: webkit/media/android/webmediaplayer_android.cc

Issue 10469003: Prepare WebMediaPlayerAndroid for bytesLoaded() -> didLoadingProgress() transition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | « webkit/media/android/webmediaplayer_android.h ('k') | 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/android/webmediaplayer_android.h" 5 #include "webkit/media/android/webmediaplayer_android.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 buffered_(1u), 53 buffered_(1u),
54 video_frame_(new WebVideoFrameImpl(VideoFrame::CreateEmptyFrame())), 54 video_frame_(new WebVideoFrameImpl(VideoFrame::CreateEmptyFrame())),
55 proxy_(new WebMediaPlayerProxyAndroid(base::MessageLoopProxy::current(), 55 proxy_(new WebMediaPlayerProxyAndroid(base::MessageLoopProxy::current(),
56 AsWeakPtr())), 56 AsWeakPtr())),
57 prepared_(false), 57 prepared_(false),
58 duration_(0), 58 duration_(0),
59 pending_seek_(0), 59 pending_seek_(0),
60 seeking_(false), 60 seeking_(false),
61 playback_completed_(false), 61 playback_completed_(false),
62 buffered_bytes_(0), 62 buffered_bytes_(0),
63 did_loading_progress_(false),
63 cookie_jar_(cookie_jar), 64 cookie_jar_(cookie_jar),
64 pending_play_event_(false), 65 pending_play_event_(false),
65 network_state_(WebMediaPlayer::NetworkStateEmpty), 66 network_state_(WebMediaPlayer::NetworkStateEmpty),
66 ready_state_(WebMediaPlayer::ReadyStateHaveNothing) { 67 ready_state_(WebMediaPlayer::ReadyStateHaveNothing) {
67 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::CreateEmptyFrame())); 68 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::CreateEmptyFrame()));
68 } 69 }
69 70
70 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { 71 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
71 if (media_player_.get()) { 72 if (media_player_.get()) {
72 media_player_->Stop(); 73 media_player_->Stop();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 258
258 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { 259 const WebTimeRanges& WebMediaPlayerAndroid::buffered() {
259 return buffered_; 260 return buffered_;
260 } 261 }
261 262
262 float WebMediaPlayerAndroid::maxTimeSeekable() const { 263 float WebMediaPlayerAndroid::maxTimeSeekable() const {
263 // TODO(hclam): If this stream is not seekable this should return 0. 264 // TODO(hclam): If this stream is not seekable this should return 0.
264 return duration(); 265 return duration();
265 } 266 }
266 267
268 bool WebMediaPlayerAndroid::didLoadingProgress() const {
269 bool ret = did_loading_progress_;
270 did_loading_progress_ = false;
271 return ret;
272 }
273
267 unsigned long long WebMediaPlayerAndroid::bytesLoaded() const { 274 unsigned long long WebMediaPlayerAndroid::bytesLoaded() const {
268 return buffered_bytes_; 275 return buffered_bytes_;
269 } 276 }
270 277
271 unsigned long long WebMediaPlayerAndroid::totalBytes() const { 278 unsigned long long WebMediaPlayerAndroid::totalBytes() const {
272 // Deprecated. 279 // Deprecated.
273 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. 280 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used.
274 return 0; 281 return 0;
275 } 282 }
276 283
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 371
365 void WebMediaPlayerAndroid::OnPlaybackComplete() { 372 void WebMediaPlayerAndroid::OnPlaybackComplete() {
366 // Set the current time equal to duration to let webkit know that play back 373 // Set the current time equal to duration to let webkit know that play back
367 // is completed. 374 // is completed.
368 playback_completed_ = true; 375 playback_completed_ = true;
369 client_->timeChanged(); 376 client_->timeChanged();
370 } 377 }
371 378
372 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) { 379 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) {
373 buffered_[0].end = duration() * percentage / 100; 380 buffered_[0].end = duration() * percentage / 100;
381 did_loading_progress_ = true;
374 // Implement a trick here to fake progress event, as WebKit checks 382 // Implement a trick here to fake progress event, as WebKit checks
375 // consecutive bytesLoaded() to see if any progress made. 383 // consecutive bytesLoaded() to see if any progress made.
376 // See HTMLMediaElement::progressEventTimerFired. 384 // See HTMLMediaElement::progressEventTimerFired.
377 // TODO(qinmin): need a method to calculate the buffered bytes. 385 // TODO(qinmin): need a method to calculate the buffered bytes.
378 buffered_bytes_++; 386 buffered_bytes_++;
379 } 387 }
380 388
381 void WebMediaPlayerAndroid::OnSeekComplete() { 389 void WebMediaPlayerAndroid::OnSeekComplete() {
382 seeking_ = false; 390 seeking_ = false;
383 391
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 485
478 WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() { 486 WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() {
479 return video_frame_.get(); 487 return video_frame_.get();
480 } 488 }
481 489
482 void WebMediaPlayerAndroid::putCurrentFrame( 490 void WebMediaPlayerAndroid::putCurrentFrame(
483 WebVideoFrame* web_video_frame) { 491 WebVideoFrame* web_video_frame) {
484 } 492 }
485 493
486 } // namespace webkit_media 494 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698