Skip to content

Commit 2457bb8

Browse files
author
Noel Algora
committed
Fixes from pullrequest fyhertz/libstreaming#276
Comment
1 parent 4f4a27c commit 2457bb8

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/d2d/testing/streaming/MediaStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public abstract class MediaStream implements Stream {
9999
Class.forName("android.media.MediaCodec");
100100
// Will be set to MODE_MEDIACODEC_API at some point...
101101
sSuggestedMode = MODE_MEDIACODEC_API;
102-
Log.i(TAG,"Phone supports the MediaCoded API");
102+
Log.i(TAG,"Phone supports the MediaCodec API");
103103
} catch (ClassNotFoundException e) {
104104
sSuggestedMode = MODE_MEDIARECORDER_API;
105105
Log.i(TAG,"Phone does not support the MediaCodec API");

app/src/main/java/d2d/testing/streaming/rtsp/RtspServer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ else if (request.method.equalsIgnoreCase("SETUP")) {
505505
return response;
506506
}
507507

508-
p = Pattern.compile("client_port=(\\d+)-(\\d+)", Pattern.CASE_INSENSITIVE);
508+
p = Pattern.compile("client_port=(\\d+)(?:-(\\d+))?", Pattern.CASE_INSENSITIVE);
509509
m = p.matcher(request.headers.get("transport"));
510510

511511
if (!m.find()) {
@@ -514,7 +514,11 @@ else if (request.method.equalsIgnoreCase("SETUP")) {
514514
p2 = ports[1];
515515
} else {
516516
p1 = Integer.parseInt(m.group(1));
517-
p2 = Integer.parseInt(m.group(2));
517+
if (m.group(2) == null) {
518+
p2 = p1+1;
519+
} else {
520+
p2 = Integer.parseInt(m.group(2));
521+
}
518522
}
519523

520524
ssrc = mSession.getTrack(trackId).getSSRC();

0 commit comments

Comments
 (0)