vlc http流与android

时间:2016-01-18 13:47:56

标签: android vlc http-streaming

我用1.8版编译了vlc for android,我发现了一个带有链接的官方演示: 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 mobile崩溃了。一开始,它有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演示? 谢谢你的帮助

1 个答案:

答案 0 :(得分:1)

这种性质的问题归因于BoardDecoder,this awesome page编译了Android上的所有解码功能。

MediaCodec类首次在Android 4.1(API 16)中推出。

在Android 4.3(API 18)中,MediaCodec已扩展为包含通过Surface提供输入的方式(通过createInputSurface方法)。

尽管Android在4.3上大力推出MediaCodec,并非所有供应商都支持它们,但需要使用智能播放器/解码器切换到软件解码。

LibVLC智能地执行,但需要通过LibVLC Options进行管理。