基于http live streaming视频直播在android上的实现(版本更新,支持高清AAC视频)

本文分享了在Android平台上实现基于HTTP Live Streaming的视频直播的技术细节,包括使用私有格式替代Apple的TS格式以节省带宽,利用JAVA层的HttpURLConnection进行流式下载,JNI层进行数据交互和解码,以及在NDK中直接渲染画面和声音。文章还讨论了音频同步、UI美化和不同Android版本的适配策略,支持从标清到高清的视频质量。
摘要由CSDN通过智能技术生成

最近将视频客户端移植到了ANDROID平台。 分享一下开发心得。 


类似HTTP LIVE STREAMING的流式下载方式, 但APPLE的TS格式冗余数据太多, 我用的是私有格式,更加节省带宽资源。H264+AMRNB编码。每个分片文件20秒。整体架构如下图:


作为HTTP下载模块对稳定性要求比较高,用NDK的话debug会很麻烦,JAVA层下载效率也还行,所以采用JAVA层的HttpURLConnection类, 服务器端在Response header里包含了下一个文件的filename,下一次的连接时将把filename作为URL的一个参数发送。这样就能做到流式的下载。 建立一个bytearrayoutputstream实例来缓存数据。 并通过JNI传递给文件解析层。 


  因为JAVA与JNI层数据交互很耗时,所以选择下载好一个完整文件再feed给Parser。 


  AUDIO必须要流畅,所以单开一个thread, Video来得及的话可以用一个timer(减少一点功耗

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
Fixed-point HE-AAC decoder Developed by RealNetworks, 2005===============================Overview--------This module contains a high-performance HE-AAC decoder for 32-bit fixed-point processors. The following is a summary of what is and is not supported:Supported: - MPEG2, MPEG4 low complexity decoding (intensity stereo, M-S, TNS, PNS) - spectral band replication (SBR), high-quality mode - mono, stereo, and multichannel modes - ADTS, ADIF, and raw data block file formatsNot currently supported: - main or SSR profile, LTP - coupling channel elements (CCE) - 960/1920-sample frame size - low-power mode SBR - downsampled (single-rate) SBR - parametric stereoHighlights - highly optimized for ARM processors (details in docs/ subdirectory) - reference x86 implementation - C and assembly code only (C++ not required for codec library) - reentrant, statically linkable - low memory (details in docs/ subdirectory) - option to use Intel Integrated Performance Primitives (details below)Supported platforms and toolchainsThis codec should run on any 32-bit fixed-point processor which can perform a full 32x32-bit multiply (providing a 64-bit result). The following processors and toolchains are supported: - x86, Microsoft Visual C++ - x86, GNU toolchain (gcc) - ARM, ARM Developer Suite (ADS) - ARM, Microsoft Embedded Visual C++ - ARM, GNU toolchain (gcc)ARM refers to any processor supporting ARM architecture v.4 or above. Thumb is not required.Generally ADS produces the fastest code. EVC 3 does not support inline assembly code for ARM targets, so calls to MULSHIFT32 (smull on ARM) are left as function calls. This incurs a significant performance penalty. For the fastest code on targets which do not normally use ADS consider compiling with ADS, using the -S option to output assembly code, and feeding this assembly code to the assem
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值