Skip to content

Commit

Permalink
Merge "Adapt to refreshed stock BufferQueue API"
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Salveti authored and Gerrit Code Review committed Jul 24, 2014
2 parents c9f7615 + f66e117 commit 44910e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion compat/camera/camera_compatibility_layer.cpp
Expand Up @@ -45,6 +45,8 @@
#include <utils/Log.h>
#include <utils/String16.h>

#include <gui/NativeBufferAlloc.h>

#include <cstring>

#define REPORT_FUNCTION() ALOGV("%s \n", __PRETTY_FUNCTION__)
Expand Down Expand Up @@ -562,7 +564,7 @@ void android_camera_set_preview_texture(CameraControl* control, int texture_id)
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
new android::BufferQueue(false, NULL, native_alloc)
#else
new android::BufferQueue(NULL, native_alloc)
new android::BufferQueue(NULL)
#endif
);

Expand Down
4 changes: 3 additions & 1 deletion compat/media/decoding_service.cpp
Expand Up @@ -38,6 +38,7 @@ typedef void* EGLSyncKHR;
#include <gui/IGraphicBufferProducer.h>
#include <gui/IGraphicBufferConsumer.h>
#include <gui/Surface.h>
#include <gui/NativeBufferAlloc.h>

namespace android {

Expand Down Expand Up @@ -240,9 +241,10 @@ void DecodingService::createBufferQueue()

// This BuferQueue is shared between the client and the service
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
sp<NativeBufferAlloc> native_alloc(new NativeBufferAlloc());
buffer_queue = new BufferQueue(false, NULL, native_alloc);
#else
buffer_queue = new BufferQueue(g_buffer_alloc);
buffer_queue = new BufferQueue(NULL);
#endif
ALOGD("buffer_queue: %p", (void*)buffer_queue.get());
buffer_queue->setBufferCount(5);
Expand Down
4 changes: 3 additions & 1 deletion compat/media/media_compatibility_layer.cpp
Expand Up @@ -44,6 +44,8 @@

#include <utils/Log.h>

#include <gui/NativeBufferAlloc.h>

#define REPORT_FUNCTION() ALOGV("%s \n", __PRETTY_FUNCTION__)

namespace android
Expand Down Expand Up @@ -482,7 +484,7 @@ int android_media_set_preview_texture(MediaPlayerWrapper *mp, int texture_id)
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
new android::BufferQueue(false, NULL, native_alloc)
#else
new android::BufferQueue(NULL, native_alloc)
new android::BufferQueue(NULL)
#endif
);

Expand Down
4 changes: 2 additions & 2 deletions compat/media/surface_texture_client_hybris.cpp
Expand Up @@ -211,15 +211,15 @@ SurfaceTextureClientHybris surface_texture_client_create_by_id(unsigned int text
return NULL;
}

#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
// Use a new native buffer allocator vs the default one, which means it'll use the proper one
// that will allow rendering to work with Mir
sp<NativeBufferAlloc> native_alloc(new NativeBufferAlloc());

#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3
sp<BufferQueue> buffer_queue(new BufferQueue(false, NULL, native_alloc));
_SurfaceTextureClientHybris *stch(new _SurfaceTextureClientHybris);
#else
sp<BufferQueue> buffer_queue(new BufferQueue(NULL, native_alloc));
sp<BufferQueue> buffer_queue(new BufferQueue(NULL));
_SurfaceTextureClientHybris *stch(new _SurfaceTextureClientHybris(buffer_queue));
#endif

Expand Down

0 comments on commit 44910e9

Please sign in to comment.