mmap out of Memory,Videoview:"无法播放此视频"

时间:2016-05-11 03:09:26

标签: c# xamarin.android mmap android-videoview

我有一个大型项目,我将视频存储在原始文件中(大约几场演出)到目前为止,一切都进展顺利。有时我的视频无法播放和显示"无法播放此视频"消息,我注意到我一直在使mmap失败:我的堆栈跟踪中的内存不足错误,我正在努力解决这个问题,而我的uri返回null。

由于我的源代码文件很庞大,我会忽略我认为的琐碎代码:

    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,这可能是个问题吗?压缩我的所有视频并确保宽度和高度正确有助于解决这个问题?还是有办法发布&#34;发布&#34; mmap记忆?任何帮助将非常感激。

1 个答案:

答案 0 :(得分:0)

我希望有一天这个问题会派上用场,问题是我的视频文件太大了,只需用5 Mb或以下的手刹就压缩视频。