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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.h

Issue 545993002: Provide fine grained media playback time thru interpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 6 years, 3 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
OLDNEW
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 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/time/default_tick_clock.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "cc/layers/video_frame_provider.h" 19 #include "cc/layers/video_frame_provider.h"
19 #include "content/common/media/media_player_messages_enums_android.h" 20 #include "content/common/media/media_player_messages_enums_android.h"
20 #include "content/public/renderer/render_frame_observer.h" 21 #include "content/public/renderer/render_frame_observer.h"
21 #include "content/renderer/media/android/media_info_loader.h" 22 #include "content/renderer/media/android/media_info_loader.h"
22 #include "content/renderer/media/android/media_source_delegate.h" 23 #include "content/renderer/media/android/media_source_delegate.h"
23 #include "content/renderer/media/android/stream_texture_factory.h" 24 #include "content/renderer/media/android/stream_texture_factory.h"
24 #include "content/renderer/media/crypto/proxy_decryptor.h" 25 #include "content/renderer/media/crypto/proxy_decryptor.h"
25 #include "gpu/command_buffer/common/mailbox.h" 26 #include "gpu/command_buffer/common/mailbox.h"
26 #include "media/base/android/media_player_android.h" 27 #include "media/base/android/media_player_android.h"
27 #include "media/base/demuxer_stream.h" 28 #include "media/base/demuxer_stream.h"
28 #include "media/base/media_keys.h" 29 #include "media/base/media_keys.h"
30 #include "media/base/time_delta_interpolator.h"
29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 31 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 32 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
31 #include "third_party/WebKit/public/platform/WebSize.h" 33 #include "third_party/WebKit/public/platform/WebSize.h"
32 #include "third_party/WebKit/public/platform/WebURL.h" 34 #include "third_party/WebKit/public/platform/WebURL.h"
33 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "third_party/skia/include/gpu/GrContext.h" 36 #include "third_party/skia/include/gpu/GrContext.h"
35 #include "third_party/skia/include/gpu/SkGrPixelRef.h" 37 #include "third_party/skia/include/gpu/SkGrPixelRef.h"
36 #include "ui/gfx/rect_f.h" 38 #include "ui/gfx/rect_f.h"
37 39
38 namespace base { 40 namespace base {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int height, bool success); 180 int height, bool success);
179 void OnPlaybackComplete(); 181 void OnPlaybackComplete();
180 void OnBufferingUpdate(int percentage); 182 void OnBufferingUpdate(int percentage);
181 void OnSeekRequest(const base::TimeDelta& time_to_seek); 183 void OnSeekRequest(const base::TimeDelta& time_to_seek);
182 void OnSeekComplete(const base::TimeDelta& current_time); 184 void OnSeekComplete(const base::TimeDelta& current_time);
183 void OnMediaError(int error_type); 185 void OnMediaError(int error_type);
184 void OnVideoSizeChanged(int width, int height); 186 void OnVideoSizeChanged(int width, int height);
185 void OnDurationChanged(const base::TimeDelta& duration); 187 void OnDurationChanged(const base::TimeDelta& duration);
186 188
187 // Called to update the current time. 189 // Called to update the current time.
188 void OnTimeUpdate(const base::TimeDelta& current_time); 190 void OnTimeUpdate(base::TimeDelta current_timestamp,
191 base::TimeTicks current_time_ticks);
189 192
190 // Functions called when media player status changes. 193 // Functions called when media player status changes.
191 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); 194 void OnConnectedToRemoteDevice(const std::string& remote_playback_message);
192 void OnDisconnectedFromRemoteDevice(); 195 void OnDisconnectedFromRemoteDevice();
193 void OnDidEnterFullscreen(); 196 void OnDidEnterFullscreen();
194 void OnDidExitFullscreen(); 197 void OnDidExitFullscreen();
195 void OnMediaPlayerPlay(); 198 void OnMediaPlayerPlay();
196 void OnMediaPlayerPause(); 199 void OnMediaPlayerPause();
197 void OnRequestFullscreen(); 200 void OnRequestFullscreen();
198 201
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 451
449 scoped_ptr<MediaSourceDelegate, 452 scoped_ptr<MediaSourceDelegate,
450 MediaSourceDelegate::Destroyer> media_source_delegate_; 453 MediaSourceDelegate::Destroyer> media_source_delegate_;
451 454
452 // Internal pending playback state. 455 // Internal pending playback state.
453 // Store a playback request that cannot be started immediately. 456 // Store a playback request that cannot be started immediately.
454 bool pending_playback_; 457 bool pending_playback_;
455 458
456 MediaPlayerHostMsg_Initialize_Type player_type_; 459 MediaPlayerHostMsg_Initialize_Type player_type_;
457 460
458 // The current playing time. Because the media player is in the browser
459 // process, it will regularly update the |current_time_| by calling
460 // OnTimeUpdate().
461 double current_time_;
462
463 // Whether the browser is currently connected to a remote media player. 461 // Whether the browser is currently connected to a remote media player.
464 bool is_remote_; 462 bool is_remote_;
465 463
466 scoped_refptr<media::MediaLog> media_log_; 464 scoped_refptr<media::MediaLog> media_log_;
467 465
468 scoped_ptr<MediaInfoLoader> info_loader_; 466 scoped_ptr<MediaInfoLoader> info_loader_;
469 467
470 // The currently selected key system. Empty string means that no key system 468 // The currently selected key system. Empty string means that no key system
471 // has been selected. 469 // has been selected.
472 std::string current_key_system_; 470 std::string current_key_system_;
(...skipping 16 matching lines...) Expand all
489 media::DecryptorReadyCB decryptor_ready_cb_; 487 media::DecryptorReadyCB decryptor_ready_cb_;
490 488
491 SkBitmap bitmap_; 489 SkBitmap bitmap_;
492 490
493 // Whether stored credentials are allowed to be passed to the server. 491 // Whether stored credentials are allowed to be passed to the server.
494 bool allow_stored_credentials_; 492 bool allow_stored_credentials_;
495 493
496 // Whether the resource is local. 494 // Whether the resource is local.
497 bool is_local_resource_; 495 bool is_local_resource_;
498 496
497 // base::TickClock used by |interpolator_|.
498 base::DefaultTickClock default_tick_clock_;
499
500 // Tracks the most recent media time update and provides interpolated values
501 // as playback progresses.
502 media::TimeDeltaInterpolator interpolator_;
503
499 // NOTE: Weak pointers must be invalidated before all other member variables. 504 // NOTE: Weak pointers must be invalidated before all other member variables.
500 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; 505 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_;
501 506
502 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); 507 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid);
503 }; 508 };
504 509
505 } // namespace content 510 } // namespace content
506 511
507 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 512 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698