Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PHZ76 committed Jan 4, 2021
1 parent 7f35536 commit 3cf7514
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/xop/RtspConnection.cpp
Expand Up @@ -158,8 +158,9 @@ bool RtspConnection::HandleRtspResponse(BufferReader& buffer)
{
#if RTSP_DEBUG
string str(buffer.Peek(), buffer.ReadableBytes());
if(str.find("rtsp")!=string::npos || str.find("RTSP") != string::npos)
if (str.find("rtsp") != string::npos || str.find("RTSP") != string::npos) {
cout << str << endl;
}
#endif

if (rtsp_response_->ParseResponse(&buffer)) {
Expand Down Expand Up @@ -360,7 +361,13 @@ void RtspConnection::HandleCmdSetup()

void RtspConnection::HandleCmdPlay()
{
if (auth_info_ != nullptr && !HandleAuthentication()) {
if (auth_info_ != nullptr) {
if (!HandleAuthentication()) {
return;
}
}

if (rtp_conn_ == nullptr) {
return;
}

Expand All @@ -376,18 +383,26 @@ void RtspConnection::HandleCmdPlay()

void RtspConnection::HandleCmdTeardown()
{
if (rtp_conn_ == nullptr) {
return;
}

rtp_conn_->Teardown();

uint16_t session_id = rtp_conn_->GetRtpSessionId();
std::shared_ptr<char> res(new char[2048]);
int size = rtsp_request_->BuildTeardownRes(res.get(), 2048, session_id);
SendRtspMessage(res, size);

HandleClose();
//HandleClose();
}

void RtspConnection::HandleCmdGetParamter()
{
if (rtp_conn_ == nullptr) {
return;
}

uint16_t session_id = rtp_conn_->GetRtpSessionId();
std::shared_ptr<char> res(new char[2048]);
int size = rtsp_request_->BuildGetParamterRes(res.get(), 2048, session_id);
Expand Down

1 comment on commit 3cf7514

@hongson23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello @PHZ76,

I have a bug which related to #34
I post my code into issue 34 but could not get any response
I captured a video that is live-stream via RTSP server
https://user-images.githubusercontent.com/4011696/99227466-dc4b0a00-281d-11eb-9a29-3f78712119da.gif
Can you give me some suggestions?

Please sign in to comment.