Streaming from multiple URLs (Peer-to-Peer)

by Hun » Wed, 04 Mar 2009 06:58:04 GMT

Sponsored Links

I am developing a peer-to-peer video streaming application for
Android, and I have been around this discussion for two months. Still
I haven't been able to find a good approach for my application.

Basically, I have multiple sources in the network (as peers). Each of
them sends a substream of a video to an Android mobile. A P2P
application (I plan to develop) is running on the mobile, and
assembles these substreams into a single stream. Then, the P2P
application passes the assembled stream to a media player for

For my purpose, none of "local file playback" and "RTSP/HTTP
streaming" work. I tried to send an MP4 clip from the multiple
sources, but I couldn't remove "gaps" between the playback of clips.

Next, I have been thinking about creating a local MP4 file by
encapsulating an assembled stream. I don't think it is a good idea,
because 1) MP4 encapsulation should be done in real time, and since
the file will grow over time, fileOpen() won't work. 2) It is just an
unnecessary, awkward step.

Finally, I came to a conclusion that I should write a new dataSource
node that will be used by PVPlayerEngine. This node will get input
from my P2P app ( I think this app should reside on top of JAVA API ),
and pass the assembled stream to the next node ( decoder node? ).

The assembled stream will be a train of H264 NAL units (created by
x264 encoder). I believe the AVC decoder included in OpenCore will
handle pure H264 NAL units, since any format parser  (such as MP4)
will return one or multiple NAL units that correspond to a single
video frame, if the input is an H264 encoded video.

Please share your thoughts on my plan. Can someone provide a better,
or strikingly easy solution?


Streaming from multiple URLs (Peer-to-Peer)

by Prajnashi S » Wed, 04 Mar 2009 13:28:32 GMT

 What's assembled stream? Do you mean you receive H264 streams from
multisite, then play them together (display each stream in an separated

-- Prajnashi S


Sponsored Links

Streaming from multiple URLs (Peer-to-Peer)

by Hun » Wed, 04 Mar 2009 20:11:29 GMT

 An original video is split into many substreams, and they are
assembled back to the original stream at the mobile. So, it is just a
single H264 video stream. I'm simply using multiple sites as a video

I wonder what would be the easiest way to achieve this plan.


Streaming from multiple URLs (Peer-to-Peer)

by Prajnashi S » Thu, 05 Mar 2009 05:07:41 GMT

 our requirement seems to play a raw 264 NAL streams, which shall be
recieved and assembled in a Java app. If you want to reuse opencore
framework, you need write a new source and file parser to receive data from
java side. Since opencore is a standalone process, you shall use any IPC
mechanism to do that (Binder, share memory, ...). To make opencore lauch
your plugins, you can define a specific URL for this case, for example,


On Thu, Mar 5, 2009 at 4:11 AM, Hun <> wrote:

-- Prajnashi S


Streaming from multiple URLs (Peer-to-Peer)

by Hun » Thu, 05 Mar 2009 07:47:17 GMT

 hank you, Prajnashi. Based on your suggestion, I think I should:

- Understand how "URL" is parsed in the OpenCore (to launch a specific
- Write a source node that receives a raw NAL unit from a JAVA
application (P2P layer).
- Understand the communication between the OpenCore process and the
JAVA application (using Binder or shared memory)

I still don't understand where "file parser" is used. Looks like the
new source node which I should add can't communicate with the next
node ( assuming it's a decoder node?) directly. In the OpenCore
source, I see "fileformats/*", where various file formats are defined.
In addition, "nodes/" contain several parser nodes. What folder is

Thank you!

On Mar 4, 9:07pm, Prajnashi S <> wrote:

Other Threads

1. Is it possible to use the accelerometer in a background service?

There is no need to use getBaseContext(); Service is itself a Context.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


2. IllegalArgumentException occur: parameter must be a descendant of this view in

I am using Android SDK 1.5. I am developing an activity with multiple
content views. It will call setContentView() with different viewgroup
instance for different functionality. It contains a text input dialog
popped up by an option menu item. I didn't specify anything for IME in
mainfest.xml & EditText attributes. I found at first, the soft
keyboard for the text input dialog will overlap on the activity
content view. But after several content view switch (by calling
setContentView() with different ViewGroup instance), the soft keyboard
will resize the activity content view.
Why this inconsistent behavior happens?

And some times, the activity is also crashed when soft keyborad is
showing for the test input dialog. Here is the log:
07-01 07:30:18.606: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:$stub$pr...@43807360
07-01 07:30:19.575: WARN/KeyCharacterMap(941): No keyboard for id 0
07-01 07:30:19.585: WARN/KeyCharacterMap(941): Using default keymap: /
07-01 07:30:21.896: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:$stub$pr...@4380ead8
07-01 07:30:28.106: DEBUG/AndroidRuntime(941): Shutting down VM
07-01 07:30:28.115: WARN/dalvikvm(941): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
07-01 07:30:28.181: ERROR/AndroidRuntime(941): Uncaught handler:
thread main exiting due to uncaught exception
07-01 07:30:28.256: ERROR/AndroidRuntime(941):
java.lang.IllegalArgumentException: parameter must be a descendant of
this view
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
java.lang.reflect.Method.invokeNative(Native Method)
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at$
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
07-01 07:30:28.256: ERROR/AndroidRuntime(941):     at
dalvik.system.NativeStart.main(Native Method)
07-01 07:30:28.267: INFO/Process(726): Sending signal. PID: 941 SIG: 3
07-01 07:30:28.267: INFO/dalvikvm(941): threadid=7: reacting to signal
07-01 07:30:28.386: INFO/dalvikvm(941): Wrote stack trace to '/data/
07-01 07:30:28.485: DEBUG/dalvikvm(726): GC freed 9705 objects /
540208 bytes in 178ms
07-01 07:35:28.289: INFO/Process(941): Sending signal. PID: 941 SIG: 9
07-01 07:35:28.325: INFO/ActivityManager(726): Process (pid 941) has died.

Is this a bug in Android framework? Cause the call stack is within
Android runtime only.

Please help. Thanks!

3. How to use drawable resource in custom XML?

4. font android

5. Animation of a View

6. Mediastore thumbnail refresh

7. Best practices for handling passwords/keys in open source projects?