Fix RTMP connection sequence

The createStream response from the server may come after onFCPublish.
Therefore we have to wait until onStatus containing NetStream.Publish.Start
status code arrives.

Signed-off-by: Leo Ma <begeekmyfriend@gmail.com>
camera2
Leo Ma 9 years ago
parent 1100bd2b5f
commit bcb8d641c6

@ -342,21 +342,21 @@ public class RtmpConnection implements RtmpPublisher, PacketRxHandler, ThreadCon
fmlePublish(); fmlePublish();
} }
} else if ("releaseStream".contains(method)) { } else if ("releaseStream".contains(method)) {
// Do nothing Log.d(TAG, "handleRxInvoke(): 'releaseStream'");
} else if ("FCPublish".contains(method)) { } else if ("FCPublish".contains(method)) {
// Do nothing Log.d(TAG, "handleRxInvoke(): 'FCPublish'");
} else { } else {
Log.w(TAG, "handleRxInvoke(): '_result' message received for unknown method: " + method); Log.w(TAG, "handleRxInvoke(): '_result' message received for unknown method: " + method);
} }
} else if (commandName.equals("onBWDone")) { } else if (commandName.equals("onBWDone")) {
// Do nothing Log.d(TAG, "handleRxInvoke(): 'onBWDone'");
} else if (commandName.equals("onFCPublish")) { } else if (commandName.equals("onFCPublish")) {
Log.d(TAG, "handleRxInvoke(): 'onFCPublish'"); Log.d(TAG, "handleRxInvoke(): 'onFCPublish'");
} else if (commandName.equals("onStatus")) {
// NetStream.Publish.Start
synchronized (publishLock) { synchronized (publishLock) {
publishLock.notifyAll(); publishLock.notifyAll();
} }
} else if (commandName.equals("onStatus")) {
// Do nothing
} else { } else {
Log.e(TAG, "handleRxInvoke(): Uknown/unhandled server invoke: " + invoke); Log.e(TAG, "handleRxInvoke(): Uknown/unhandled server invoke: " + invoke);
} }

Loading…
Cancel
Save