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

Thomas Guillem git at videolan.org
Wed Oct 24 18:14:42 CEST 2018


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

mediacodec: fix undefined behavior on LP32

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

(cherry picked from commit c454d1737f1b4bf2ba10c1eb3cbdbfc8b37d512b)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 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 3d782252e5..e276347b43 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