开发者

Transfer video frames in chunks and then recombine them?

Hope everyone of you doing great.I really need your help.My scenario is given below.

1-I am getting a continuous data (byte array[]) from my camera . 2-Now sending those byte[] through UDP but i have to halve that array because i can't send that big array. (P.S i can't use JMF as its not supported at my device(serv开发者_高级运维er side) so have to send byte[] manually through UDP) 3-I am receiving those byte [] chunks at client side.

Now i have following requirement.

-I want a player at the client side which plays my these byte [] chunks but in continuous way.(At client side i can use JMF)

Now i don't know how should i combine all these byte[] chunks at client side so that my video gets play continuously.

Please help as you guys always do.

Best regards ZB


As an option, you may consider vlcj for video streaming.

Examples how to stream media from camera with VLC player, which may be also of some interest.


If you are transmitting over UDP I assume you are aware of the standard caveats regarding ordering and dropped packets.

I would send the data in the following fashion.

Define a datagram format which has a header and payload with the header being something quite simple like

<packetnumber><timestamp><payloadlength>
<payload>

So you'd create you chunk which is an array of bytes, calculate the payload length, current packet number and timestamp before appending the chunk. Then transmit the whole array and when it's received you can remove the packet number, timestamp and use the payload length to retrieve the data.

Then load the payload into buffer. I'd be tempted to create an object which has the packet number as a key and an array of bytes, then have a doubly linked list of these objects as the buffer. You use the packet number to see where to insert into list and to play back you just keep getting the object with the lowest packet number.

You'll need to define some control data for packet number reseting etc and flow control.

I may have made this more complex by ignoring common libraries but this is the logic I'd follow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜