You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in Streamer class:
startStreaming method:
if (muxer.isConnected())
this condition called after muxer.open(url, width, height);
but muxer.open is async method.
so sometimes run muxer.isConnected() then run rtmpMuxer.open((String) msg.obj, msg.arg1, msg.arg2);
that's make muxer.isConnected() allways return false;
so in Muxer class:
private ArrayBlockingQueue waiterLock = new ArrayBlockingQueue<>(10);
void open(String url, int width, int height) {
Message message = handler.obtainMessage(MSG_OPEN, url);
message.arg1 = width;
message.arg2 = height;
handler.sendMessage(message);
try {
waiterLock.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
in Streamer class:
startStreaming method:
if (muxer.isConnected())
this condition called after muxer.open(url, width, height);
but muxer.open is async method.
so sometimes run muxer.isConnected() then run rtmpMuxer.open((String) msg.obj, msg.arg1, msg.arg2);
that's make muxer.isConnected() allways return false;
so in Muxer class:
private ArrayBlockingQueue waiterLock = new ArrayBlockingQueue<>(10);
void open(String url, int width, int height) {
Message message = handler.obtainMessage(MSG_OPEN, url);
message.arg1 = width;
message.arg2 = height;
handler.sendMessage(message);
try {
waiterLock.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
case MSG_OPEN:
rtmpMuxer.open((String) msg.obj, msg.arg1, msg.arg2);
try {
if (listener != null) {
uiHandler.post(new Runnable() {
@OverRide
public void run() {
if (isConnected()) {
listener.onStarted();
disconnected = false;
closed = false;
} else {
listener.onFailedToConnect();
}
}
});
}
waiterLock.put(true);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
break;
The text was updated successfully, but these errors were encountered: