Opened 9 years ago
Closed 9 years ago
#5620 closed defect (fixed)
av_tempfile failed to create file on android
Reported by: | chinshou | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avutil |
Version: | git-master | Keywords: | android cache regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
when using cache protocol on android to download the file to local.
android report ff_tempfile: Cannot open temporary file error.
Change History (6)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Keywords: | android cache regression added |
---|---|
Priority: | normal → important |
Reproduced by developer: | set |
Status: | new → open |
Regression since fd6af5375bcf3f78c61e4b0ca2e4274436746436
$ ffmpeg -i cache:fate-suite/4xm/dracula.4xm ffmpeg version N-80268-g9e9286e Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.9 (GCC) 20140827 (prerelease) configuration: --cross-prefix=../android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --arch=arm --target-os=linux --sysroot=../android-ndk-r10e/platforms/android-17/arch-arm/ --enable-gpl --cpu=cortex-a8 libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 46.100 / 57. 46.100 libavformat 57. 37.101 / 57. 37.101 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 46.101 / 6. 46.101 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [cache @ 0x158a7a0] [TEMPFILE @ 0xbeffeeec] ff_tempfile: Cannot open temporary file /tmp/ffcacheSW7060 [cache @ 0x158a7a0] Failed to create tempfile cache:fate-suite/4xm/dracula.4xm: Permission denied
comment:3 by , 9 years ago
try adding || defined(__ANDROID__) and maybe try /sdcard in adition to /tmp android is messy from a linux/posix point of view
follow-up: 5 comment:4 by , 9 years ago
The following works as expected:
diff --git a/libavutil/file_open.c b/libavutil/file_open.c index 6e58cc1..34070d9 100644 --- a/libavutil/file_open.c +++ b/libavutil/file_open.c @@ -134,7 +134,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l #else snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); fd = mkstemp(*filename); -#ifdef _WIN32 +#if defined(_WIN32) || defined (__ANDROID__) if (fd < 0) { snprintf(*filename, len, "./%sXXXXXX", prefix); fd = mkstemp(*filename);
/sdcard leads to an error message when testing:
$ ffmpeg -i cache:fate-suite/4xm/dracula.4xm ffmpeg version N-80268-g9e9286e Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.9 (GCC) 20140827 (prerelease) configuration: --cross-prefix=../android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --arch=arm --target-os=linux --sysroot=../android-ndk-r10e/platforms/android-17/arch-arm/ --enable-gpl --cpu=cortex-a8 libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 46.100 / 57. 46.100 libavformat 57. 37.101 / 57. 37.101 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 46.101 / 6. 46.101 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [cache @ 0x158a7a0] seek in cache failed Last message repeated 2 times [4xm @ 0x158a0f0] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for Input Stream #0.1 : stereo Guessed Channel Layout for Input Stream #0.2 : stereo Guessed Channel Layout for Input Stream #0.3 : stereo Guessed Channel Layout for Input Stream #0.4 : stereo Guessed Channel Layout for Input Stream #0.5 : stereo Guessed Channel Layout for Input Stream #0.6 : stereo Input #0, 4xm, from 'cache:fate-suite/4xm/dracula.4xm': Duration: 00:00:01.93, start: 0.000000, bitrate: 4236 kb/s Stream #0:0: Video: 4xm, rgb565le, 640x480, 15 tbr, 15 tbn, 15 tbc Stream #0:1: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s Stream #0:2: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s Stream #0:3: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s Stream #0:4: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s Stream #0:5: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s Stream #0:6: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s At least one output file must be specified [cache @ 0x158a7a0] Statistics, cache hits:0 cache misses:3
diff --git a/libavutil/file_open.c b/libavutil/file_open.c index 6e58cc1..4d05267 100644 --- a/libavutil/file_open.c +++ b/libavutil/file_open.c @@ -132,7 +132,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l # endif fd = open(*filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600); #else - snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); + snprintf(*filename, len, "/sdcard/%sXXXXXX", prefix); fd = mkstemp(*filename); #ifdef _WIN32 if (fd < 0) {
comment:5 by , 9 years ago
Replying to cehoyos:
The following works as expected:
diff --git a/libavutil/file_open.c b/libavutil/file_open.c index 6e58cc1..34070d9 100644 --- a/libavutil/file_open.c +++ b/libavutil/file_open.c @@ -134,7 +134,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l #else snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); fd = mkstemp(*filename); -#ifdef _WIN32 +#if defined(_WIN32) || defined (__ANDROID__) if (fd < 0) { snprintf(*filename, len, "./%sXXXXXX", prefix); fd = mkstemp(*filename);
please submit this to ffmpeg-devel if you agree that it is a acceptable solution
comment:6 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Should be fixed in 4c9d1c6f9a8f166703dc0333b53f5dba8dc5b414
Note:
See TracTickets
for help on using tickets.
How can I reproduce this issue?