From 3d2428a1f9cda3f0d9080f1b0dc64a1d7b5da490 Mon Sep 17 00:00:00 2001 From: Leonew Date: Fri, 5 Jan 2018 16:10:27 +0800 Subject: [PATCH] fix C2 may not send during rtmp handshake --- .../java/com/github/faucamp/simplertmp/io/RtmpConnection.java | 1 + .../java/com/github/faucamp/simplertmp/packets/Handshake.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java b/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java index 4525011..5c31ca5 100644 --- a/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java +++ b/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java @@ -94,6 +94,7 @@ public class RtmpConnection implements RtmpPublisher { handshake.readS0(in); handshake.readS1(in); handshake.writeC2(out); + out.flush(); handshake.readS2(in); } diff --git a/library/src/main/java/com/github/faucamp/simplertmp/packets/Handshake.java b/library/src/main/java/com/github/faucamp/simplertmp/packets/Handshake.java index 2a7b50f..ca78852 100644 --- a/library/src/main/java/com/github/faucamp/simplertmp/packets/Handshake.java +++ b/library/src/main/java/com/github/faucamp/simplertmp/packets/Handshake.java @@ -162,7 +162,7 @@ public final class Handshake { /** Generates and writes the third handshake packet (C2) */ public final void writeC2(OutputStream out) throws IOException { - Log.d(TAG, "readC2"); + Log.d(TAG, "writeC2"); // C2 is an echo of S1 if (s1 == null) { throw new IllegalStateException("C2 cannot be written without S1 being read first");