我正在尝试通过udp从我的Android设备向本地wifi广播音频文件,并让本地网络上的客户端通过VLC的网络流选项收听它.我可以播放它并在连接到网络的任何设备上接收它,如果我使用我自己的接收代码,但我希望VLC能够播放它.在发送数据报包之前,是否需要进行任何特定的编码或格式化?
我的发送代码
public void SendAudio()
{
Thread thrd = new Thread(new Runnable() {
@Override
public void run()
{
Log.e(LOG_TAG, "start send thread, thread id: "
+ Thread.currentThread().getId());
long file_size = 0;
int bytes_read = 0;
int bytes_count = 0;
File audio = new File(AUDIO_FILE_PATH);
FileInputStream audio_stream = null;
file_size = audio.length();
byte[] buf = new byte[BUF_SIZE];
try
{
InetAddress addr = InetAddress.getByName("192.168.1.255");
DatagramSocket sock = new DatagramSocket();
while(true){
bytes_