[vlc-commits] mediacodec: fix undefined behavior on LP32

Thomas Guillem git at videolan.org
Wed Oct 24 18:04:02 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 24 18:02:20 2018 +0200| [c454d1737f1b4bf2ba10c1eb3cbdbfc8b37d512b] | committer: Thomas Guillem

mediacodec: fix undefined behavior on LP32

cf. https://github.com/android-ndk/ndk/issues/459

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c454d1737f1b4bf2ba10c1eb3cbdbfc8b37d512b
---

 modules/codec/omxil/mediacodec_ndk.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/mediacodec_ndk.c b/modules/codec/omxil/mediacodec_ndk.c
index c8a8680772..a72bf165cb 100644
--- a/modules/codec/omxil/mediacodec_ndk.c
+++ b/modules/codec/omxil/mediacodec_ndk.c
@@ -78,6 +78,13 @@ typedef enum {
  * NdkMediaCodec.h
  *****************************************************************************/
 
+/* cf. https://github.com/android-ndk/ndk/issues/459 */
+#if defined(__USE_FILE_OFFSET64) && !defined(__LP64__)
+#define off_t_compat int32_t
+#else
+#define off_t_compat off_t
+#endif
+
 struct AMediaCodec;
 typedef struct AMediaCodec AMediaCodec;
 
@@ -132,7 +139,7 @@ typedef uint8_t* (*pf_AMediaCodec_getInputBuffer)(AMediaCodec*,
         size_t idx, size_t *out_size);
 
 typedef media_status_t (*pf_AMediaCodec_queueInputBuffer)(AMediaCodec*,
-        size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags);
+        size_t idx, off_t_compat offset, size_t size, uint64_t time, uint32_t flags);
 
 typedef ssize_t (*pf_AMediaCodec_dequeueOutputBuffer)(AMediaCodec*,
         AMediaCodecBufferInfo *info, int64_t timeoutUs);



More information about the vlc-commits mailing list