Skip to content

Commit 88cee98

Browse files
committed
Bumped version to 1.2.20; includes fixes for RTMP/E
1 parent 316c45d commit 88cee98

File tree

5 files changed

+37
-26
lines changed

5 files changed

+37
-26
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>1.2.19</version>
6+
<version>1.2.20</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-client</artifactId>

src/main/java/org/red5/client/Red5Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public final class Red5Client {
1818
/**
1919
* Current server version with revision
2020
*/
21-
public static final String VERSION = "Red5 Client 1.2.6";
21+
public static final String VERSION = "Red5 Client 1.2.20";
2222

2323
/**
2424
* Create a new Red5Client object using the connection local to the current thread A bit of magic that lets you access the red5 scope

src/main/java/org/red5/client/net/rtmpe/RTMPEIoFilter.java

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,38 @@ public void messageReceived(NextFilter nextFilter, IoSession session, Object obj
122122
}
123123
// complete the connection regardless of the S2 success or failure
124124
completeConnection(session, conn, handshake);
125+
} else {
126+
// don't fall through to connected process if we didn't have enough for the handshake
127+
break;
125128
}
126129
// allow fall-through
127130
case RTMP.STATE_CONNECTED:
128-
IoBuffer message = buffer.getBufferAsIoBuffer();
129-
// assuming majority of connections will not be encrypted
130-
if (!((RTMPConnection) conn).isEncrypted()) {
131-
Cipher cipher = (Cipher) session.getAttribute(RTMPConnection.RTMPE_CIPHER_IN);
132-
if (cipher != null) {
133-
if (log.isDebugEnabled()) {
134-
log.debug("Decrypting message: {}", message);
135-
}
136-
byte[] encrypted = new byte[message.remaining()];
137-
message.get(encrypted);
138-
message.free();
139-
byte[] plain = cipher.update(encrypted);
140-
IoBuffer messageDecrypted = IoBuffer.wrap(plain);
141-
if (log.isDebugEnabled()) {
142-
log.debug("Decrypted buffer: {}", messageDecrypted);
143-
}
144-
nextFilter.messageReceived(session, messageDecrypted);
131+
// skip empty buffer
132+
if (buffer.getBufferSize() > 0) {
133+
IoBuffer message = buffer.getBufferAsIoBuffer();
134+
// assuming majority of connections will not be encrypted
135+
if (!((RTMPConnection) conn).isEncrypted()) {
136+
log.trace("Receiving message: {}", message);
137+
nextFilter.messageReceived(session, message);
145138
} else {
146-
log.warn("Decryption cipher is missing from the session");
139+
Cipher cipher = (Cipher) session.getAttribute(RTMPConnection.RTMPE_CIPHER_IN);
140+
if (cipher != null) {
141+
if (log.isDebugEnabled()) {
142+
log.debug("Decrypting message: {}", message);
143+
}
144+
byte[] encrypted = new byte[message.remaining()];
145+
message.get(encrypted);
146+
message.free();
147+
byte[] plain = cipher.update(encrypted);
148+
IoBuffer messageDecrypted = IoBuffer.wrap(plain);
149+
if (log.isDebugEnabled()) {
150+
log.debug("Decrypted buffer: {}", messageDecrypted);
151+
}
152+
nextFilter.messageReceived(session, messageDecrypted);
153+
} else {
154+
log.warn("Decryption cipher is missing from the session");
155+
}
147156
}
148-
} else {
149-
log.trace("Not decrypting message: {}", obj);
150-
nextFilter.messageReceived(session, obj);
151157
}
152158
break;
153159
case RTMP.STATE_ERROR:

src/test/java/org/red5/client/net/rtmp/RTMPClientTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ public class RTMPClientTest {
2020
// task timer
2121
private static Timer timer = new Timer();
2222

23+
// application name
24+
private static String app = "oflaDemo"; //"vod";
25+
2326
// AMS sample
2427
// private static String sourceStreamName = "mp4:sample1_1500kbps.f4v";
2528

29+
// sample video under oflaDemo example app
30+
private static String sourceStreamName = "mp4:thx_deep_note_360p.mp4";
31+
2632
// local sample
27-
private static String sourceStreamName = "flashContent";
33+
//private static String sourceStreamName = "flashContent";
2834

2935
// https://github.com/Red5/red5-client/issues/26
3036
@Test
@@ -76,7 +82,7 @@ public void resultReceived(IPendingServiceCall call) {
7682
* client.invoke("loadPlaylist", params, new IPendingServiceCallback() {
7783
* @Override public void resultReceived(IPendingServiceCall result) { System.out.println(result); } }); } } });
7884
*/
79-
client.connect("localhost", 1935, "vod", connectCallback);
85+
client.connect("localhost", 1935, app, connectCallback);
8086

8187
do {
8288
try {

src/test/java/org/red5/client/net/rtmp/RTMPHandshakeTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public void testOutboundHandshake() {
126126
// send in the combined server handshake, this creates C2
127127
C2 = out.decodeServerResponse1(S0S1S2);
128128
log.debug("C2 (third): {}", C2);
129-
130129
}
131130

132131
@Test

0 commit comments

Comments
 (0)