Skip to content

Commit

Permalink
Two small bug fixes in the RtspClient
Browse files Browse the repository at this point in the history
  • Loading branch information
fyhertz committed Oct 21, 2013
1 parent cc38d92 commit a544ce6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/net/majorkernelpanic/streaming/rtsp/RtspClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void setSession(Session session) {
public Session getSession() {
return mSession;
}

/**
* Sets the destination address of the RTSP server.
* @param host The destination address
Expand Down Expand Up @@ -190,8 +190,12 @@ private void sendRequestAnnounce() throws IllegalStateException, SocketException
mOutputStream.write(request.getBytes("UTF-8"));
Response response = Response.parseResponse(mBufferedReader);

Log.v(TAG,"RTSP Server:" + response.headers.get("server"));

if (response.headers.containsKey("server")) {
Log.v(TAG,"RTSP server name:" + response.headers.get("server"));
} else {
Log.v(TAG,"RTSP server name unknown");
}

try {
Matcher m = Response.rexegSession.matcher(response.headers.get("session"));
m.find();
Expand Down Expand Up @@ -293,11 +297,12 @@ private void sendRequestTeardown() throws IOException {

private String addHeaders() {
return "CSeq: " + (++mCSeq) + "\r\n" +
"Content-Length: 0\r\n" +
"Session: " + mSessionID + "\r\n" +
"Authorization: " + mAuthorization + "\r\n\r\n";
"Content-Length: 0\r\n" +
"Session: " + mSessionID + "\r\n" +
(mAuthorization != null ? "Authorization: " + mAuthorization + "\r\n":"") +
"\r\n";
}

final protected static char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};

private static String bytesToHex(byte[] bytes) {
Expand Down

0 comments on commit a544ce6

Please sign in to comment.