本文介绍了视频流通过蓝牙,安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发连接与基于Android的设备通过蓝牙在PC的应用程序,我已经建立了连接,并实现了我的大多数项目的想法。

I am developing an application connecting a PC with Android based device over bluetooth, I have established the connection and implemented most of my project ideas.

不过,我想从PC向设备添加流媒体功能,我没有任何code然而,因为我还处于规划阶段!所以我想问问任何有用的资源或教程?任何有帮助的第一步?

However, I would like to add streaming functionality from the PC to the device, I don't have any code yet as I am still in the planning stage! So I would like to ask for any helpful resources or tutorials? anything helpful as a first step?

我已经实现了PC端,我基本上得到的字节数组的形式流帧,发送到Android端...

I have implemented the PC side where I basically get the stream frames in the form of byte array, to be sent to the Android side...

任何帮助将是非常美联社preciated

Any help would be highly appreciated

推荐答案

我们能找到的是实际执行的简单协议转让的最简单方法。我们的COM pressed各帧,将其分为数据包在PC端,增加了对每个数据包包含帧和数据包数的总长度的报头,并且为整个帧的报头的分组,

The simplest way we could find was to actually implement a simple protocol for the transfer.We compressed the individual frames, divided them into packets at the PC side, added a header for each packet, and a header packet for the entire frame, containing the total length of the frame and number of packets.

目前在Android方面,我们跑了两个嵌套的循环,一个用于流的框架,以及一个用于单个数据包的报文。我们从该帧的第一分组所使用的数据,以计算出的环的长度和时断裂,之后我们得到的总的帧大小(由第一分组验证)我们发送的总字节组成函数变换所述阵列成JPG IMMAGE,并用帆布continuesly显示帧...

At the android side, we ran two nested loops, one for the frames of the stream, and one for the packets of individual packets. We used the data from the first packet of the frame to figure out the length of the loop and when to break, after we get the total frame size (verified by the first packet) we sent the total bytearray into a function converting the array into jpg immage, and used a canvas to continuesly showing the frames...

我们得到大约每秒两帧,这是够用了蓝牙...

we got about two frames per second, which was good enough for bluetooth...

这篇关于视频流通过蓝牙,安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 14:11