Commit c3c38c3c6e1b4a502b8a373cc9eb18bc0b00e88f

Authored by Hu Chunming
1 parent 1116447e

代码优化

src/decoder/gb28181/DvppGB28181Decoder.cpp
... ... @@ -74,11 +74,12 @@ void DvppGB28181Decoder::close(){
74 74  
75 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 78 pthread_join(m_post_decode_thread,0);
80 79 }
81 80  
  81 + streamDecoder.Close();
  82 +
82 83 m_status = ECLOSED;
83 84  
84 85 LOG_INFO("解码器关闭成功 --{}", m_dec_name);
... ... @@ -137,6 +138,8 @@ bool DvppGB28181Decoder::start() {
137 138 return true;
138 139 }
139 140  
  141 + close();
  142 +
140 143 LOG_ERROR("[{}] - rtp receiver open failed !", m_dec_name);
141 144  
142 145 return bRet;
... ...
src/decoder/gb28181/rtp/RTPUdpReceiver.cpp
... ... @@ -123,8 +123,13 @@ bool RTPUdpReceiver::Open(string channel_id)
123 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 133 m_bOpened = true;
129 134 LOG_INFO("[{}] Open ok", m_SipChannelId);
130 135  
... ...