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

Side by Side Diff: media/base/android/media_player_bridge.h

Issue 1372203002: Throttle media decoding after excessive Android media server crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new infobar text per UI review Created 5 years, 2 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
« no previous file with comments | « media/base/android/media_player_android.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 23 matching lines...) Expand all
34 // the Android MediaPlayer instance. 34 // the Android MediaPlayer instance.
35 class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid { 35 class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid {
36 public: 36 public:
37 static bool RegisterMediaPlayerBridge(JNIEnv* env); 37 static bool RegisterMediaPlayerBridge(JNIEnv* env);
38 38
39 // Construct a MediaPlayerBridge object. This object needs to call |manager|'s 39 // Construct a MediaPlayerBridge object. This object needs to call |manager|'s
40 // RequestMediaResources() before decoding the media stream. This allows 40 // RequestMediaResources() before decoding the media stream. This allows
41 // |manager| to track unused resources and free them when needed. 41 // |manager| to track unused resources and free them when needed.
42 // MediaPlayerBridge also forwards Android MediaPlayer callbacks to 42 // MediaPlayerBridge also forwards Android MediaPlayer callbacks to
43 // the |manager| when needed. 43 // the |manager| when needed.
44 MediaPlayerBridge(int player_id, 44 MediaPlayerBridge(
45 const GURL& url, 45 int player_id,
46 const GURL& first_party_for_cookies, 46 const GURL& url,
47 const std::string& user_agent, 47 const GURL& first_party_for_cookies,
48 bool hide_url_log, 48 const std::string& user_agent,
49 MediaPlayerManager* manager, 49 bool hide_url_log,
50 const RequestMediaResourcesCB& request_media_resources_cb, 50 MediaPlayerManager* manager,
51 const GURL& frame_url, 51 const OnDecoderResourcesReleasedCB& on_decoder_resources_released_cb,
52 bool allow_credentials); 52 const GURL& frame_url,
53 bool allow_credentials);
53 ~MediaPlayerBridge() override; 54 ~MediaPlayerBridge() override;
54 55
55 // Initialize this object and extract the metadata from the media. 56 // Initialize this object and extract the metadata from the media.
56 virtual void Initialize(); 57 virtual void Initialize();
57 58
58 // MediaPlayerAndroid implementation. 59 // MediaPlayerAndroid implementation.
59 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; 60 void SetVideoSurface(gfx::ScopedJavaSurface surface) override;
60 void Start() override; 61 void Start() override;
61 void Pause(bool is_media_related_action) override; 62 void Pause(bool is_media_related_action) override;
62 void SeekTo(base::TimeDelta timestamp) override; 63 void SeekTo(base::TimeDelta timestamp) override;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 int height_; 168 int height_;
168 169
169 // Meta data about actions can be taken. 170 // Meta data about actions can be taken.
170 bool can_pause_; 171 bool can_pause_;
171 bool can_seek_forward_; 172 bool can_seek_forward_;
172 bool can_seek_backward_; 173 bool can_seek_backward_;
173 174
174 // Cookies for |url_|. 175 // Cookies for |url_|.
175 std::string cookies_; 176 std::string cookies_;
176 177
178 // The surface object currently owned by the player.
179 gfx::ScopedJavaSurface surface_;
180
177 // Java MediaPlayerBridge instance. 181 // Java MediaPlayerBridge instance.
178 base::android::ScopedJavaGlobalRef<jobject> j_media_player_bridge_; 182 base::android::ScopedJavaGlobalRef<jobject> j_media_player_bridge_;
179 183
180 base::RepeatingTimer time_update_timer_; 184 base::RepeatingTimer time_update_timer_;
181 185
182 // Volume of playback. 186 // Volume of playback.
183 double volume_; 187 double volume_;
184 188
185 // Whether user credentials are allowed to be passed. 189 // Whether user credentials are allowed to be passed.
186 bool allow_credentials_; 190 bool allow_credentials_;
187 191
188 // NOTE: Weak pointers must be invalidated before all other member variables. 192 // NOTE: Weak pointers must be invalidated before all other member variables.
189 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_; 193 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_;
190 194
191 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); 195 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge);
192 }; 196 };
193 197
194 } // namespace media 198 } // namespace media
195 199
196 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 200 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/media_player_android.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698