robertdoo / red5

Automatically exported from code.google.com/p/red5
0 stars 0 forks source link

BaseRTMPClientHandler uses wrong callback in case of several parallel requests #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version 1.0RC1 (also present in trunk rev 4238).

TC:

1. Create RTMPClient
2. Connect to server
3. Publish several streams - provide separate callbacks into RTMPClient.publish 
method

Expected result: when result arrives - onStatus NetStream.Publish.Start - 
appropriate callback is called
Actual result: first provided callback is always called.

The problem is in BaseRTMPClientHandler.onInvoke:

if (clientId == null) { // <<< here clientId is available so it is used
    clientId = source.getStreamId();
}

log.debug("Client/stream id: {}", clientId);
if (clientId != null) {
    // try lookup by client id first
    NetStreamPrivateData streamData = streamDataMap.get(clientId); // <<< streamDataMap holds streamIds as keys not clientIds so nothing is found
    // if null try to supply the first one in the map
    if (streamData == null) {
        log.debug("Stream data map: {}", streamDataMap);
        streamData = streamDataMap.get(1); // <<< so callback for streamId=1 is retrieved and used
    }

Original issue reported on code.google.com by dmitry.m...@mind.com on 27 Jun 2011 at 3:34

GoogleCodeExporter commented 9 years ago

Original comment by mondain on 29 Apr 2012 at 3:18

GoogleCodeExporter commented 9 years ago
Stream id from the header is always used now, starting with revision 4356

Original comment by mondain on 16 May 2012 at 2:06