Index: content/common/gpu/gl_surface_encoder.cc |
diff --git a/content/common/gpu/gl_surface_encoder.cc b/content/common/gpu/gl_surface_encoder.cc |
index efa717f743a5426c4f4455eb6763a1abc329850e..ea0cad1e9f26e1a05c75afd723edc9dacd82a5b8 100644 |
--- a/content/common/gpu/gl_surface_encoder.cc |
+++ b/content/common/gpu/gl_surface_encoder.cc |
@@ -12,14 +12,30 @@ |
#include "media/base/video_frame.h" |
#include "ui/gl/gl_surface.h" |
+#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
+#include "content/common/gpu/media/exynos_video_encode_accelerator.h" |
+#include "ui/gl/gl_surface_egl.h" |
+#endif |
+ |
namespace content { |
-namespace { |
+static bool MakeEncoderContextCurrent( |
+ const base::WeakPtr<GpuCommandBufferStub> stub) { |
+ if (!stub) { |
+ DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; |
+ return false; |
+ } |
-void DoNothingWithSurface(gfx::GLSurface* surface) { |
+ if (!stub->decoder()->MakeCurrent()) { |
+ DLOG(ERROR) << "Failed to MakeCurrent()"; |
+ return false; |
+ } |
+ |
+ return true; |
} |
-} // anonymous namespace |
+static void DoNothingWithSurface(gfx::GLSurface* surface) { |
+} |
GLSurfaceEncoder::GLSurfaceEncoder(int32 host_route_id, |
GpuCommandBufferStub* stub) |
@@ -117,7 +133,17 @@ scoped_ptr<media::VideoEncodeAccelerator> GLSurfaceEncoder::CreateEncoder( |
media::VideoEncodeAccelerator::Client* client) { |
scoped_ptr<media::VideoEncodeAccelerator> encoder; |
- // TODO(sheu): actually create an encoder. |
+ base::Callback<bool(void)> make_current = |
+ base::Bind(&MakeEncoderContextCurrent, stub->AsWeakPtr()); |
+ |
+#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
+ encoder.reset(new ExynosVideoEncodeAccelerator( |
+ gfx::GLSurfaceEGL::GetHardwareDisplay(), |
+ client, |
+ make_current, |
+ true)); |
+#endif |
+ |
return encoder.Pass(); |
} |