mmap 内存不足,Videoview:"Can't play this video"

mmap out of Memory, Videoview: "Can't play this video"

我有一个大型项目,我将视频存储在原始文件中(大约几个演出)直到现在一切都进展顺利。有时我的视频无法播放并显示 "Can't play this video" 消息,我注意到我一直收到 mmap failed: Out of memory errors in my stack trace 我正在努力解决这个问题,我的 uri returns 空。

由于我的源代码文件很大,我将省略我认为是微不足道的代码:

    VideoView Video = FindViewById <VideoView>(Resource.Id.videoViewMainActivty);


    MediaController mediaController = new MediaController(this, true);
    Video.SetMediaController (mediaController);

    var uri = Android.Net.Uri.Parse ("android.resource://" + PackageName + "/" + Resource.Raw.V11_2_1_1_Completing_the_square);
    Video.SetVideoURI (uri);
    Video.Start ();

日志:

[libEGL] loaded /system/lib/egl/libEGL_mali.so
[libEGL] loaded /system/lib/egl/libGLESv1_CM_mali.so
[libEGL] loaded /system/lib/egl/libGLESv2_mali.so
[] Device driver API match
[] Device driver API version: 10
[] User space API version: 10 
[] mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Tue Oct 16 15:37:13 KST 2012 
[OpenGLRenderer] Enabling debug mode 0
Thread finished: <Thread Pool> #5
[Mono] [0xb8c7e958] worker finishing
Thread finished: <Thread Pool> #3
Thread finished: <Thread Pool> #4
[Mono] [0xb9648f00] worker finishing
[GestureDetector] [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 5 mFalseSizeCnt:0
[dalvikvm-heap] Grow heap (frag case) to 13.961MB for 1536016-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 16.558MB for 2724712-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 19.158MB for 2724712-byte allocation
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
Thread started: <Thread Pool> #6
Thread started: <Thread Pool> #7
[Mono] [0xb945f918] worker starting
Thread started: <Thread Pool> #8
[Mono] [0xba4f20e0] worker starting
Thread finished: <Thread Pool> #7
[Mono] [0xb945f918] worker finishing
[GestureDetector] [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 4 mFalseSizeCnt:0
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[GestureDetector] [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 5 mFalseSizeCnt:0
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[GestureDetector] [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 7 mFalseSizeCnt:0
[webclipboard] clipservice: android.sec.clipboard.ClipboardExManager@42367570
[webkit] BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {423615d0}
[webview] registerForStylusPenEvent onAttachedToWindow
[webview] registerForStylusPenEvent START
[webview] registerForStylusPenEvent END
Thread started: <Thread Pool> #9
[Mono] [0xbcd08d90] worker starting
[MediaPlayer-JNI] native_setup
[MediaPlayer] constructor
[MediaPlayer] setListener
[MediaPlayer] path is null
[filemap] mmap(0,1068406440) failed: Out of memory
[asset] create map from entry failed
[MediaPlayer] Couldn't open file on client side, trying server side
[MediaPlayer] setVideoSurfaceTexture
[MediaPlayer-JNI] setAudioStreamType: 3
[MediaPlayer] MediaPlayer::setAudioStreamType
[MediaPlayer] setVideoSurfaceTexture
[MediaPlayer] prepareAsync
[MediaPlayer] message received msg=100, ext1=1, ext2=-2147483648
[MediaPlayer] error (1, -2147483648)
Thread started: <Thread Pool> #10
[MediaPlayer] callback application
[MediaPlayer] back from callback
[Mono] [0xbd0a4958] worker starting
[ProgressBar] setProgressDrawable mProgressDrawable = null, d = android.graphics.drawable.LayerDrawable@42bf8ae0needUpdate = false
[ProgressBar] setProgress = 0
[ProgressBar] setProgress = 0, fromUser = false
[ProgressBar] mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
Thread started: <Thread Pool> #11
[Mono] [0xbd0ff870] worker starting
[MediaPlayer] Error (1,-2147483648)
[VideoView] Error: 1,-2147483648
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport attempting to load: '__Internal'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'monodroid_get_system_property'.
[Mono] Probing 'monodroid_get_system_property'.
[Mono] Found as 'monodroid_get_system_property'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'monodroid_free'.
[Mono] Probing 'monodroid_free'.
[Mono] Found as 'monodroid_free'.
[Mono] DllImport loaded library '(null)'.
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'monodroid_get_system_property'.
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

我已经确定我的编码是正确的并且视频有时会播放。出于某种原因,我在处理这段视频时遇到了问题。该文件是 21MB,这可能是个问题吗?压缩我的所有视频并确保宽度和高度正确是否有助于解决此问题?或者有没有办法 "release" mmap 内存?任何帮助将非常感激。

我希望这个问题有一天能派上用场,问题是我的视频文件太大,只需使用手刹将视频压缩到 5 Mb 或以下即可。