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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index cddec41d3d2c34502f88734081ea88c859cc64a2..4e865bcd5d7d0055fff5be37973e162434d2ede5 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -96,6 +96,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
client_(client),
delegate_(delegate),
buffered_(static_cast<size_t>(1)),
+ main_loop_(base::MessageLoopProxy::current()),
media_loop_(media_loop),
ignore_metadata_duration_change_(false),
pending_seek_(false),
@@ -1031,6 +1032,7 @@ void WebMediaPlayerAndroid::DrawRemotePlaybackText(
}
void WebMediaPlayerAndroid::ReallocateVideoFrame() {
+ DCHECK(main_thread_checker_.CalledOnValidThread());
if (needs_external_surface_) {
// VideoFrame::CreateHoleFrame is only defined under VIDEO_HOLE.
#if defined(VIDEO_HOLE)
@@ -1047,6 +1049,7 @@ void WebMediaPlayerAndroid::ReallocateVideoFrame() {
} else if (!is_remote_ && texture_id_) {
GLES2Interface* gl = stream_texture_factory_->ContextGL();
GLuint texture_id_ref = 0;
+ // FIXME: reuse texture pool like gpu_video_decoder.
dshwang 2014/06/03 15:39:40 Currently every frame create new texture. We can a
gl->GenTextures(1, &texture_id_ref);
GLuint texture_target = kGLTextureExternalOES;
gl->BindTexture(texture_target, texture_id_ref);
@@ -1109,6 +1112,13 @@ scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() {
void WebMediaPlayerAndroid::PutCurrentFrame(
const scoped_refptr<media::VideoFrame>& frame) {
+ // Create new VideoFrame when a client return the previous frame.
+ DCHECK(!main_thread_checker_.CalledOnValidThread());
+ // FIXME: instead of here, VideoFrameProvider::Client::DidReceiveFrame() can
+ // handle it.
dshwang 2014/06/03 15:39:40 I use PutCurrentFrame() as the end of each frame,
+ main_loop_->PostTask(FROM_HERE,
+ base::Bind(&WebMediaPlayerAndroid::ReallocateVideoFrame,
+ weak_factory_.GetWeakPtr()));
}
void WebMediaPlayerAndroid::TryCreateStreamTextureProxyIfNeeded() {
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698