【发布时间】:2016-04-23 17:11:37
【问题描述】:
我用 1.8 版本为 android 编译了 vlc,我找到了一个带有链接的官方演示: https://bitbucket.org/edwardcw/libvlc-android-sample 。它适用于 localVideo。我尝试播放http流,所以我更改了以下代码:
// Create LibVLC
// TODO: make this more robust, and sync with audio demo
ArrayList<String> options = new ArrayList<String>();
//options.add("--subsdec-encoding <encoding>");
options.add("--aout=opensles");
options.add("--audio-time-stretch"); // time stretching
options.add("-vvv"); // verbosity
libvlc = new LibVLC(options);
libvlc.setOnHardwareAccelerationError(this);
holder.setKeepScreenOn(true);
// Create media player
mMediaPlayer = new MediaPlayer(libvlc);
mMediaPlayer.setEventListener(mPlayerListener);
// Set up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(mSurface);
//vout.setSubtitlesView(mSurfaceSubtitles);
vout.addCallback(this);
vout.attachViews();
//Media m = new Media(libvlc, media);
Uri uri = Uri.parse(httpAddress);
Media m = new Media(libvlc, uri);
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
在三星,android 4.1.2 上运行良好。但它与 mi4 手机崩溃。开始时,有 2 秒的声音没有图像,然后它就崩溃了,就像 ANR 一样,但永远保持黑屏。 这是logcat:
core video output: picture is too late to be displayed (missing 953 ms)
core vout display: Failed to change zoom
android_window vout display: change source crop/aspect
core video output: picture is too late to be displayed (missing 1156 ms)
core vout display: auto hiding mouse cursor
core audio output: playback too late (66254): up-sampling
core video output: picture is too late to be displayed (missing 1155 ms)
core video output: picture is too late to be displayed (missing 1153 ms)
[OMX.qcom.video.decoder.avc] ERROR(0x80001009)
Codec reported an error. (omx error 0x80001009, internalError -2147483648)
mediacodec decoder: Exception in MediaCodec.dequeueOutputBuffer
mediacodec decoder: dequeue_out failed
mediacodec decoder: OutThread stopped
threadid=16: thread exiting, not yet detached (count=0)
Error with hardware acceleration
more log info 我在哪里可以找到符合 vlc 1.8 的 httpstream 演示? 感谢您的帮助
【问题讨论】:
-
好的,当我关闭硬件加速时,它工作正常。我使用代码 media.setHWDecoderEnabled(false, false);
标签: android vlc http-streaming