diff options
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/screenrecord/screenrecord.cpp | 15 | ||||
-rw-r--r-- | cmds/stagefright/Android.mk | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/cmds/screenrecord/screenrecord.cpp b/cmds/screenrecord/screenrecord.cpp index a5fbe16..3f8567c 100644 --- a/cmds/screenrecord/screenrecord.cpp +++ b/cmds/screenrecord/screenrecord.cpp @@ -36,6 +36,7 @@ #include <media/ICrypto.h> #include <stdio.h> +#include <fcntl.h> #include <signal.h> #include <getopt.h> @@ -595,7 +596,19 @@ int main(int argc, char* const argv[]) { return 2; } - status_t err = recordScreen(argv[optind]); + // MediaMuxer tries to create the file in the constructor, but we don't + // learn about the failure until muxer.start(), which returns a generic + // error code without logging anything. We attempt to create the file + // now for better diagnostics. + const char* fileName = argv[optind]; + int fd = open(fileName, O_CREAT | O_RDWR, 0644); + if (fd < 0) { + fprintf(stderr, "Unable to open '%s': %s\n", fileName, strerror(errno)); + return 1; + } + close(fd); + + status_t err = recordScreen(fileName); ALOGD(err == NO_ERROR ? "success" : "failed"); return (int) err; } diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk index 1060131..561ce02 100644 --- a/cmds/stagefright/Android.mk +++ b/cmds/stagefright/Android.mk @@ -19,6 +19,8 @@ LOCAL_C_INCLUDES:= \ LOCAL_CFLAGS += -Wno-multichar +LOCAL_MODULE_TAGS := optional + LOCAL_MODULE:= stagefright include $(BUILD_EXECUTABLE) |