|
|
|
@ -213,7 +213,9 @@ static status_t prepareEncoder(float displayFps, sp<MediaCodec>* pCodec,
|
|
|
|
|
* Sets the display projection, based on the display dimensions, video size,
|
|
|
|
|
* and device orientation.
|
|
|
|
|
*/
|
|
|
|
|
static status_t setDisplayProjection(const sp<IBinder>& dpy,
|
|
|
|
|
static status_t setDisplayProjection(
|
|
|
|
|
SurfaceComposerClient::Transaction& t,
|
|
|
|
|
const sp<IBinder>& dpy,
|
|
|
|
|
const DisplayInfo& mainDpyInfo) {
|
|
|
|
|
|
|
|
|
|
// Set the region of the layer stack we're interested in, which in our
|
|
|
|
@ -279,7 +281,7 @@ static status_t setDisplayProjection(const sp<IBinder>& dpy,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SurfaceComposerClient::setDisplayProjection(dpy,
|
|
|
|
|
t.setDisplayProjection(dpy,
|
|
|
|
|
gRotate ? DISPLAY_ORIENTATION_90 : DISPLAY_ORIENTATION_0,
|
|
|
|
|
layerStackRect, displayRect);
|
|
|
|
|
return NO_ERROR;
|
|
|
|
@ -295,11 +297,11 @@ static status_t prepareVirtualDisplay(const DisplayInfo& mainDpyInfo,
|
|
|
|
|
sp<IBinder> dpy = SurfaceComposerClient::createDisplay(
|
|
|
|
|
String8("ScreenRecorder"), false /*secure*/);
|
|
|
|
|
|
|
|
|
|
SurfaceComposerClient::openGlobalTransaction();
|
|
|
|
|
SurfaceComposerClient::setDisplaySurface(dpy, bufferProducer);
|
|
|
|
|
setDisplayProjection(dpy, mainDpyInfo);
|
|
|
|
|
SurfaceComposerClient::setDisplayLayerStack(dpy, 0); // default stack
|
|
|
|
|
SurfaceComposerClient::closeGlobalTransaction();
|
|
|
|
|
SurfaceComposerClient::Transaction t;
|
|
|
|
|
t.setDisplaySurface(dpy, bufferProducer);
|
|
|
|
|
setDisplayProjection(t, dpy, mainDpyInfo);
|
|
|
|
|
t.setDisplayLayerStack(dpy, 0); // default stack
|
|
|
|
|
t.apply();
|
|
|
|
|
|
|
|
|
|
*pDisplayHandle = dpy;
|
|
|
|
|
|
|
|
|
@ -379,9 +381,9 @@ static status_t runEncoder(const sp<MediaCodec>& encoder,
|
|
|
|
|
ALOGW("getDisplayInfo(main) failed: %d", err);
|
|
|
|
|
} else if (orientation != mainDpyInfo.orientation) {
|
|
|
|
|
ALOGD("orientation changed, now %d", mainDpyInfo.orientation);
|
|
|
|
|
SurfaceComposerClient::openGlobalTransaction();
|
|
|
|
|
setDisplayProjection(virtualDpy, mainDpyInfo);
|
|
|
|
|
SurfaceComposerClient::closeGlobalTransaction();
|
|
|
|
|
SurfaceComposerClient::Transaction t;
|
|
|
|
|
setDisplayProjection(t, virtualDpy, mainDpyInfo);
|
|
|
|
|
t.apply();
|
|
|
|
|
orientation = mainDpyInfo.orientation;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|