Ticket #1985: deadlock-freebox.10277.diff
File deadlock-freebox.10277.diff, 3.3 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/freeboxrecorder.cpp
4 4 * Distributed as part of MythTV under GPL v2 and later. 5 5 */ 6 6 7 #include "freeboxrecorder.h" 8 7 9 #include <qwaitcondition.h> 8 10 #include <qmutex.h> 9 11 … … 15 17 #include "mpeg/tspacket.h" 16 18 #include "freeboxchannel.h" 17 19 #include "freeboxmediasink.h" 18 #include "freeboxrecorder.h"19 20 20 21 // ============================================================================ 21 22 // FreeboxData : Helper class use for static Callback handler … … 47 48 MediaSession& session = subsession->parentSession(); 48 49 MediaSubsessionIterator iter(session); 49 50 50 while ( subsession = iter.next())51 while ((subsession = iter.next())) 51 52 { 52 53 if (subsession->sink) 53 54 return; … … 76 77 FreeboxChannel *channel) : 77 78 _rec(recorder), 78 79 _streamData(1, true), 80 _curChanInfo(channel->GetCurrentChanInfo()), 79 81 _live_env(NULL), 80 82 _rtsp_client(NULL), 81 83 _session(NULL), … … 99 101 100 102 // Gets 101 103 FreeboxChannelInfo GetCurrentChanInfo(void) const 102 { return _c hannel->GetCurrentChanInfo(); }104 { return _curChanInfo; } 103 105 MPEGStreamData& StreamData(void) 104 106 { return _streamData; } 105 107 UsageEnvironment* GetLiveEnv(void) … … 113 115 void SetLiveEnv(UsageEnvironment *env) { _live_env = env; } 114 116 void SetRTSPClient(RTSPClient *client) { _rtsp_client = client; } 115 117 void SetSession(MediaSession *session) { _session = session; } 118 void SetChannelInfo(const FreeboxChannelInfo& chanInfo) 119 { _curChanInfo = chanInfo; } 116 120 117 121 public: // MPEGSingleProgramStreamListener 118 122 void HandleSingleProgramPAT(ProgramAssociationTable *pat); … … 121 125 private: 122 126 FreeboxRecorder *_rec; 123 127 MPEGStreamData _streamData; 128 FreeboxChannelInfo _curChanInfo; 124 129 UsageEnvironment *_live_env; 125 130 RTSPClient *_rtsp_client; 126 131 MediaSession *_session; … … 157 162 // Ensure RTSP cleanup, remove old RTSP session 158 163 MediaSubsessionIterator iter(*_session); 159 164 MediaSubsession *subsession; 160 while ( subsession = iter.next())165 while ((subsession = iter.next())) 161 166 { 162 167 Medium::close(subsession->sink); 163 168 subsession->sink = NULL; … … 194 199 _impl->Close(); 195 200 } 196 201 197 void FreeboxRecorder::ChannelChanged(const FreeboxChannelInfo& )202 void FreeboxRecorder::ChannelChanged(const FreeboxChannelInfo& chanInfo) 198 203 { 199 // Channel change, we need to close current RTSP flow, and open a new one 204 // keep a copy to avoid deadlocks 205 _impl->SetChannelInfo(chanInfo); 206 // Channel changed, we need to close current RTSP flow, and open a new one 200 207 ResetEventLoop(); 201 208 } 202 209 … … 308 315 MediaSubsession *subsession; 309 316 bool madeProgress = false; 310 317 311 while ( subsession = iter.next())318 while ((subsession = iter.next())) 312 319 { 313 320 if (!subsession->initiate(-1)) 314 321 { … … 363 370 madeProgress = false; 364 371 iter.reset(); 365 372 366 while ( subsession = iter.next())373 while ((subsession = iter.next())) 367 374 { 368 375 if (!subsession->readSource()) 369 376 continue; // was not initiated