通过网络https传输音频的好策略是什么?

时间:2016-01-04 18:17:11

标签: file-upload mp3 audio-streaming multipartform-data flac

我的andriod app是bandwidh约束。它的工作频率应低至64kbps。

用户将录制语音(最长120秒,平均60秒)

然后将使用编码器对其进行编码(选项为:

1. Losless: FLAC or ALAC?
2. lossy: MP3?

Say文件是1024 kb,即1 MB。

So I am thinking sending file by dividing into of chunks of size 32kb 
and 
if response is received in 1 sec after request:
     exponentially increasing size of chunks then 
else  
    The app will binary search for exact chunk size.

3. Is my approach to transfer an audio from android to server 
feasible for low speed connections?
4. Or is it better to push the entire file in 
multi-part form-data to server in one https post call?

1 个答案:

答案 0 :(得分:1)

假设你这样做:

  1. 录制音频文件
  2. 压缩文件
  3. 上传文件
  4. 您正在通过使用tcp的https上传。没有理由以指数方式增加块的大小,因为内部TCP会自动执行此操作以公平地共享带宽。它被称为慢启动 没有理由把它分块并让它成长。此外,最大数据包大小为64k。

    只需打开一个流并发送即可。让底层网络协议处理细节。 在您的服务器上,您可能必须更改服务器设置以允许大文件上载并增加超时设置。

相关问题