Commit c3c38c3c6e1b4a502b8a373cc9eb18bc0b00e88f
1 parent
1116447e
代码优化
Showing
2 changed files
with
12 additions
and
4 deletions
src/decoder/gb28181/DvppGB28181Decoder.cpp
@@ -74,11 +74,12 @@ void DvppGB28181Decoder::close(){ | @@ -74,11 +74,12 @@ void DvppGB28181Decoder::close(){ | ||
74 | 74 | ||
75 | // if (gpu_options) av_dict_free(&gpu_options); | 75 | // if (gpu_options) av_dict_free(&gpu_options); |
76 | 76 | ||
77 | - if (m_post_decode_thread != 0) | ||
78 | - { | 77 | + if (m_post_decode_thread != 0) { |
79 | pthread_join(m_post_decode_thread,0); | 78 | pthread_join(m_post_decode_thread,0); |
80 | } | 79 | } |
81 | 80 | ||
81 | + streamDecoder.Close(); | ||
82 | + | ||
82 | m_status = ECLOSED; | 83 | m_status = ECLOSED; |
83 | 84 | ||
84 | LOG_INFO("解码器关闭成功 --{}", m_dec_name); | 85 | LOG_INFO("解码器关闭成功 --{}", m_dec_name); |
@@ -137,6 +138,8 @@ bool DvppGB28181Decoder::start() { | @@ -137,6 +138,8 @@ bool DvppGB28181Decoder::start() { | ||
137 | return true; | 138 | return true; |
138 | } | 139 | } |
139 | 140 | ||
141 | + close(); | ||
142 | + | ||
140 | LOG_ERROR("[{}] - rtp receiver open failed !", m_dec_name); | 143 | LOG_ERROR("[{}] - rtp receiver open failed !", m_dec_name); |
141 | 144 | ||
142 | return bRet; | 145 | return bRet; |
src/decoder/gb28181/rtp/RTPUdpReceiver.cpp
@@ -123,8 +123,13 @@ bool RTPUdpReceiver::Open(string channel_id) | @@ -123,8 +123,13 @@ bool RTPUdpReceiver::Open(string channel_id) | ||
123 | return false; | 123 | return false; |
124 | } | 124 | } |
125 | 125 | ||
126 | - RequestStream(); | ||
127 | - | 126 | + bool bReq = RequestStream(); |
127 | + if (!bReq) { | ||
128 | + LOG_INFO("[{}] RequestStream failed !", m_SipChannelId); | ||
129 | + Close(); | ||
130 | + return false; | ||
131 | + } | ||
132 | + | ||
128 | m_bOpened = true; | 133 | m_bOpened = true; |
129 | LOG_INFO("[{}] Open ok", m_SipChannelId); | 134 | LOG_INFO("[{}] Open ok", m_SipChannelId); |
130 | 135 |