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();
}
} else if ("releaseStream".contains(method)) {
// Do nothing
Log.d(TAG, "handleRxInvoke(): 'releaseStream'");
} else if ("FCPublish".contains(method)) {
// Do nothing
Log.d(TAG, "handleRxInvoke(): 'FCPublish'");
} else {
Log.w(TAG, "handleRxInvoke(): '_result' message received for unknown method: " + method);
}
} else if (commandName.equals("onBWDone")) {
// Do nothing
Log.d(TAG, "handleRxInvoke(): 'onBWDone'");
} else if (commandName.equals("onFCPublish")) {
Log.d(TAG, "handleRxInvoke(): 'onFCPublish'");
} else if (commandName.equals("onStatus")) {
// NetStream.Publish.Start
synchronized (publishLock) {
publishLock.notifyAll();
}
} else if (commandName.equals("onStatus")) {
// Do nothing
} else {
Log.e(TAG, "handleRxInvoke(): Uknown/unhandled server invoke: " + invoke);
}
@ -434,4 +434,4 @@ public class RtmpConnection implements RtmpPublisher, PacketRxHandler, ThreadCon
audio.getHeader().setAbsoluteTimestamp(dts);
writeThread.send(audio);
}
}
}
Loading…
Cancel
Save