mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed a deadlock in the SVDRP command PLAY in case there is currently a recording being replayed
This commit is contained in:
parent
7170c20c7e
commit
63a32ce483
2
HISTORY
2
HISTORY
@ -8961,3 +8961,5 @@ Video Disk Recorder Revision History
|
|||||||
Thanks to Sergey Chernyavskiy.
|
Thanks to Sergey Chernyavskiy.
|
||||||
- Changed 'number' to 'id' in the help texts of SVDRP commands that deal with
|
- Changed 'number' to 'id' in the help texts of SVDRP commands that deal with
|
||||||
timers.
|
timers.
|
||||||
|
- Fixed a deadlock in the SVDRP command PLAY in case there is currently a
|
||||||
|
recording being replayed.
|
||||||
|
23
svdrp.c
23
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* graphical interface that sits on top of an SVDRP connection.
|
||||||
*
|
*
|
||||||
* $Id: svdrp.c 4.14 2017/04/04 09:39:36 kls Exp $
|
* $Id: svdrp.c 4.15 2017/04/04 11:01:10 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "svdrp.h"
|
#include "svdrp.h"
|
||||||
@ -2057,8 +2057,14 @@ void cSVDRPServer::CmdPLAY(const char *Option)
|
|||||||
char c = *option;
|
char c = *option;
|
||||||
*option = 0;
|
*option = 0;
|
||||||
if (isnumber(num)) {
|
if (isnumber(num)) {
|
||||||
LOCK_RECORDINGS_READ;
|
cStateKey StateKey;
|
||||||
|
if (const cRecordings *Recordings = cRecordings::GetRecordingsRead(StateKey)) {
|
||||||
if (const cRecording *Recording = Recordings->GetById(strtol(num, NULL, 10))) {
|
if (const cRecording *Recording = Recordings->GetById(strtol(num, NULL, 10))) {
|
||||||
|
cString FileName = Recording->FileName();
|
||||||
|
cString Title = Recording->Title();
|
||||||
|
int FramesPerSecond = Recording->FramesPerSecond();
|
||||||
|
bool IsPesRecording = Recording->IsPesRecording();
|
||||||
|
StateKey.Remove(); // must give up the lock for the call to cControl::Shutdown()
|
||||||
if (c)
|
if (c)
|
||||||
option = skipspace(++option);
|
option = skipspace(++option);
|
||||||
cReplayControl::SetRecording(NULL);
|
cReplayControl::SetRecording(NULL);
|
||||||
@ -2066,21 +2072,24 @@ void cSVDRPServer::CmdPLAY(const char *Option)
|
|||||||
if (*option) {
|
if (*option) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
if (strcasecmp(option, "BEGIN") != 0)
|
if (strcasecmp(option, "BEGIN") != 0)
|
||||||
pos = HMSFToIndex(option, Recording->FramesPerSecond());
|
pos = HMSFToIndex(option, FramesPerSecond);
|
||||||
cResumeFile Resume(Recording->FileName(), Recording->IsPesRecording());
|
cResumeFile Resume(FileName, IsPesRecording);
|
||||||
if (pos <= 0)
|
if (pos <= 0)
|
||||||
Resume.Delete();
|
Resume.Delete();
|
||||||
else
|
else
|
||||||
Resume.Save(pos);
|
Resume.Save(pos);
|
||||||
}
|
}
|
||||||
cReplayControl::SetRecording(Recording->FileName());
|
cReplayControl::SetRecording(FileName);
|
||||||
cControl::Launch(new cReplayControl);
|
cControl::Launch(new cReplayControl);
|
||||||
cControl::Attach();
|
cControl::Attach();
|
||||||
Reply(250, "Playing recording \"%s\" [%s]", num, Recording->Title());
|
Reply(250, "Playing recording \"%s\" [%s]", num, *Title);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
StateKey.Remove();
|
||||||
Reply(550, "Recording \"%s\" not found", num);
|
Reply(550, "Recording \"%s\" not found", num);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Reply(501, "Error in recording number \"%s\"", num);
|
Reply(501, "Error in recording number \"%s\"", num);
|
||||||
free(opt);
|
free(opt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user