diff options
author | Andreas Huber <andih@google.com> | 2013-01-30 21:33:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-01-30 21:33:23 +0000 |
commit | 3d6aa43575ae3342a93f88dd035f299e99554797 (patch) | |
tree | 457c9994632ea32728c854fd187d90eb43bc1e09 /media | |
parent | a6a88d9c445e261972c2433254e0a996336e78a4 (diff) | |
parent | 0fcdb7271e1a25bc501ead6093ab1ae2667fdd47 (diff) | |
download | frameworks_av-3d6aa43575ae3342a93f88dd035f299e99554797.zip frameworks_av-3d6aa43575ae3342a93f88dd035f299e99554797.tar.gz frameworks_av-3d6aa43575ae3342a93f88dd035f299e99554797.tar.bz2 |
Merge "Actually display something on screen when instantiating a wfd sink via"
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/wifi-display/sink/DirectRenderer.cpp | 3 | ||||
-rw-r--r-- | media/libstagefright/wifi-display/wfd.cpp | 38 |
2 files changed, 39 insertions, 2 deletions
diff --git a/media/libstagefright/wifi-display/sink/DirectRenderer.cpp b/media/libstagefright/wifi-display/sink/DirectRenderer.cpp index 8120634..93430eb 100644 --- a/media/libstagefright/wifi-display/sink/DirectRenderer.cpp +++ b/media/libstagefright/wifi-display/sink/DirectRenderer.cpp @@ -270,7 +270,8 @@ void DirectRenderer::dequeueAccessUnits() { err = mVideoDecoder->configure( videoFormat, - new SurfaceTextureClient(mSurfaceTex), + mSurfaceTex == NULL + ? NULL : new SurfaceTextureClient(mSurfaceTex), NULL /* crypto */, 0 /* flags */); diff --git a/media/libstagefright/wifi-display/wfd.cpp b/media/libstagefright/wifi-display/wfd.cpp index be9e35e..21d661e 100644 --- a/media/libstagefright/wifi-display/wfd.cpp +++ b/media/libstagefright/wifi-display/wfd.cpp @@ -23,6 +23,7 @@ #include <binder/ProcessState.h> #include <binder/IServiceManager.h> +#include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> #include <media/AudioSystem.h> #include <media/IMediaPlayerService.h> @@ -31,6 +32,7 @@ #include <media/stagefright/DataSource.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AMessage.h> +#include <ui/DisplayInfo.h> namespace android { @@ -282,12 +284,44 @@ int main(int argc, char **argv) { exit(1); } + sp<SurfaceComposerClient> composerClient = new SurfaceComposerClient; + CHECK_EQ(composerClient->initCheck(), (status_t)OK); + + sp<IBinder> display(SurfaceComposerClient::getBuiltInDisplay( + ISurfaceComposer::eDisplayIdMain)); + DisplayInfo info; + SurfaceComposerClient::getDisplayInfo(display, &info); + ssize_t displayWidth = info.w; + ssize_t displayHeight = info.h; + + ALOGV("display is %d x %d\n", displayWidth, displayHeight); + + sp<SurfaceControl> control = + composerClient->createSurface( + String8("A Surface"), + displayWidth, + displayHeight, + PIXEL_FORMAT_RGB_565, + 0); + + CHECK(control != NULL); + CHECK(control->isValid()); + + SurfaceComposerClient::openGlobalTransaction(); + CHECK_EQ(control->setLayer(INT_MAX), (status_t)OK); + CHECK_EQ(control->show(), (status_t)OK); + SurfaceComposerClient::closeGlobalTransaction(); + + sp<Surface> surface = control->getSurface(); + CHECK(surface != NULL); + sp<ANetworkSession> session = new ANetworkSession; session->start(); sp<ALooper> looper = new ALooper; - sp<WifiDisplaySink> sink = new WifiDisplaySink(session); + sp<WifiDisplaySink> sink = new WifiDisplaySink( + session, surface->getSurfaceTexture()); looper->registerHandler(sink); if (connectToPort >= 0) { @@ -298,5 +332,7 @@ int main(int argc, char **argv) { looper->start(true /* runOnCallingThread */); + composerClient->dispose(); + return 0; } |