summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2013-09-19 11:08:33 -0700
committerAndy McFadden <fadden@android.com>2013-09-19 11:08:33 -0700
commit253dfdb983611b8375c9e0b0483eda03fa146028 (patch)
tree022b83177f4dcb12d554ea24175a38cd3df320d0 /cmds
parent6cc3a9948b51193dfdcb0c3527d7f3d1ca38aa3c (diff)
downloadframeworks_av-253dfdb983611b8375c9e0b0483eda03fa146028.zip
frameworks_av-253dfdb983611b8375c9e0b0483eda03fa146028.tar.gz
frameworks_av-253dfdb983611b8375c9e0b0483eda03fa146028.tar.bz2
Rotate fallback size
If configuring the encoder for display-size recording fails, we drop back to 720p. This was done a bit too literally, and didn't look good in portrait mode. Rotate the fallback size as needed. Bug 10826876 Change-Id: Id3130471fc1467afa8bf91d75c9d4a49245253c3
Diffstat (limited to 'cmds')
-rw-r--r--cmds/screenrecord/screenrecord.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp
index 68289a5..49999b5 100644
--- a/cmds/screenrecord/screenrecord.cpp
+++ b/cmds/screenrecord/screenrecord.cpp
@@ -464,12 +464,16 @@ static status_t recordScreen(const char* fileName) {
err = prepareEncoder(mainDpyInfo.fps, &encoder, &bufferProducer);
if (err != NO_ERROR && !gSizeSpecified) {
- if (gVideoWidth != kFallbackWidth && gVideoHeight != kFallbackHeight) {
+ // fallback is defined for landscape; swap if we're in portrait
+ bool needSwap = gVideoWidth < gVideoHeight;
+ uint32_t newWidth = needSwap ? kFallbackHeight : kFallbackWidth;
+ uint32_t newHeight = needSwap ? kFallbackWidth : kFallbackHeight;
+ if (gVideoWidth != newWidth && gVideoHeight != newHeight) {
ALOGV("Retrying with 720p");
- fprintf(stderr, "WARNING: failed at %dx%d, retrying at 720p\n",
- gVideoWidth, gVideoHeight);
- gVideoWidth = kFallbackWidth;
- gVideoHeight = kFallbackHeight;
+ fprintf(stderr, "WARNING: failed at %dx%d, retrying at %dx%d\n",
+ gVideoWidth, gVideoHeight, newWidth, newHeight);
+ gVideoWidth = newWidth;
+ gVideoHeight = newHeight;
err = prepareEncoder(mainDpyInfo.fps, &encoder, &bufferProducer);
}
}