Problem with streamdev-cvs and subtitles - workaround

Message ID 42E9023B.7010701@gmail.com
State New
Headers

Commit Message

Anssi Hannula July 28, 2005, 4:05 p.m. UTC
  Anssi Hannula wrote:
> Hi!
> 
> Is anyone using subtitles (with subtitles-plugin) successfully in a 
> streamdev-cvs client?
> 
> When I switch to any channel (subtitles or not), the video may stay 
> black, and jnettop confirms that no data is sent to the client. Same 
> thing happens with either dxr3 or xine as client's frontend. The client 
> is is running in the same host as the server. I suspect some race 
> condition in the plugin.
> 

I managed to work around this problem with the attached patch 
(Apparently CmdTUNE deletes and recreates m_LiveStreamer, but nobody 
starts it again). I don't know if the patch has any side effects. Maybe 
streamdev's maintainer can see what's the problem and make a proper fix.

The debuglogs are in the original message.
  

Comments

Anssi Hannula July 28, 2005, 4:57 p.m. UTC | #1
Anssi Hannula wrote:
> Anssi Hannula wrote:
> 
>> Hi!
>>
>> Is anyone using subtitles (with subtitles-plugin) successfully in a 
>> streamdev-cvs client?
>>
>> When I switch to any channel (subtitles or not), the video may stay 
>> black, and jnettop confirms that no data is sent to the client. Same 
>> thing happens with either dxr3 or xine as client's frontend. The 
>> client is is running in the same host as the server. I suspect some 
>> race condition in the plugin.
>>
> 
> I managed to work around this problem with the attached patch 
> (Apparently CmdTUNE deletes and recreates m_LiveStreamer, but nobody 
> starts it again). I don't know if the patch has any side effects. Maybe 
> streamdev's maintainer can see what's the problem and make a proper fix.
> 

Apparently not so good workaround...
Now if I start client with:

-P"osdteletext -d /opt/vdr-shared/vtx" -Popenmhp -Pstreamdev-client 
-Ptext2skin -Pyaepg -Pdvd -P"xine -r" -Psubtitles
=> everything works

-P"xine -r" -P"osdteletext -d /opt/vdr-shared/vtx" -Popenmhp 
-Pstreamdev-client -Ptext2skin -Pyaepg -Pdvd  -Psubtitles
=> server crashes immediately when client starts

And I'm unable to get the dxr3 plugin working with this at all. Server 
always crashes.

I'll try to put some mutex locking to the streamdev classes, if I can 
figure out how they work ;)
  
Anssi Hannula July 28, 2005, 6:59 p.m. UTC | #2
Anssi Hannula wrote:
> Anssi Hannula wrote:
> 
>> Anssi Hannula wrote:
>>
>>> Is anyone using subtitles (with subtitles-plugin) successfully in a 
>>> streamdev-cvs client?
>>>
>>> When I switch to any channel (subtitles or not), the video may stay 
>>> black, and jnettop confirms that no data is sent to the client. Same 
>>> thing happens with either dxr3 or xine as client's frontend. The 
>>> client is is running in the same host as the server. I suspect some 
>>> race condition in the plugin.
>>>
>>
>> I managed to work around this problem with the attached patch 
>> (Apparently CmdTUNE deletes and recreates m_LiveStreamer, but nobody 
>> starts it again). I don't know if the patch has any side effects. 
>> Maybe streamdev's maintainer can see what's the problem and make a 
>> proper fix.
>>
> And I'm unable to get the dxr3 plugin working with this at all. Server 
> always crashes.
> 
> I'll try to put some mutex locking to the streamdev classes, if I can 
> figure out how they work ;)
> 

Well, the problem indeed is in the order of OpenDvr, Set/Add/DelPid, and 
SetChannelDevice. When using subtitles plugin those differ. Also, if I 
tried to insert additional CloseDvr(); OpenDvr(); into those other 
functions, so that it would be executed as the last command, the server 
segfaults with a crapped backtrace.

Cut from the backtrace:
#2336 0x66a58f41 in ?? ()
#2337 0x354ba17e in ?? ()
#2338 0xe224fb44 in ?? ()
#2339 0xe19edc01 in ?? ()
#2340 0x05fd481f in ?? ()
#2341 0x714c71af in ?? ()
  
Niko Mikkila July 28, 2005, 9:48 p.m. UTC | #3
On Thu, 28 Jul 2005 21:59:27 +0300
Anssi Hannula <anssi.hannula@gmail.com> wrote:

> Well, the problem indeed is in the order of OpenDvr, Set/Add/DelPid, and 
> SetChannelDevice. When using subtitles plugin those differ. Also, if I 
> tried to insert additional CloseDvr(); OpenDvr(); into those other 
> functions, so that it would be executed as the last command, the server 
> segfaults with a crapped backtrace.
> 
> Cut from the backtrace:
> #2336 0x66a58f41 in ?? ()
> #2337 0x354ba17e in ?? ()
> #2338 0xe224fb44 in ?? ()
> #2339 0xe19edc01 in ?? ()
> #2340 0x05fd481f in ?? ()
> #2341 0x714c71af in ?? ()
>

Maybe you haven't compiled everything with debugging symbols? Each plugin
has its own Makefile, right.

Nice to see that you're getting this fixed. I can confirm that I've had the same problem
for a few months, but never got around to find out what was going on.
I'm on vacation next week, so maybe I could help you then if there are still
problems.

--Niko
  
Anssi Hannula July 28, 2005, 9:56 p.m. UTC | #4
Niko Mikkila wrote:
> On Thu, 28 Jul 2005 21:59:27 +0300
> Anssi Hannula <anssi.hannula@gmail.com> wrote:
> 
> 
>>Well, the problem indeed is in the order of OpenDvr, Set/Add/DelPid, and 
>>SetChannelDevice. When using subtitles plugin those differ. Also, if I 
>>tried to insert additional CloseDvr(); OpenDvr(); into those other 
>>functions, so that it would be executed as the last command, the server 
>>segfaults with a crapped backtrace.
>>
>>Cut from the backtrace:
>>#2336 0x66a58f41 in ?? ()
>>#2337 0x354ba17e in ?? ()
>>#2338 0xe224fb44 in ?? ()
>>#2339 0xe19edc01 in ?? ()
>>#2340 0x05fd481f in ?? ()
>>#2341 0x714c71af in ?? ()
>>
> 
> 
> Maybe you haven't compiled everything with debugging symbols? Each plugin
> has its own Makefile, right.

I use Make.config which is included by all plugins and has -g in CXXFLAGS.

> Nice to see that you're getting this fixed. I can confirm that I've had the same problem
> for a few months, but never got around to find out what was going on.
> I'm on vacation next week, so maybe I could help you then if there are still
> problems.

I'll continue investigating this next week.
  

Patch

Index: server/connectionVTP.c
===================================================================
RCS file: /var/cvsroot/streamdev/server/connectionVTP.c,v
retrieving revision 1.7
diff -u -p -r1.7 connectionVTP.c
--- server/connectionVTP.c	9 May 2005 20:22:29 -0000	1.7
+++ server/connectionVTP.c	28 Jul 2005 15:53:24 -0000
@@ -637,8 +637,10 @@  bool cConnectionVTP::CmdPORT(char *Opts)
 		return Respond(551, "Couldn't open data connection");
 	}
 
-	if (id == siLive)
+	if (id == siLive) {
+		m_LiveStreamer->Stop();
 		m_LiveStreamer->Start(m_LiveSocket);
+	}
 
   return Respond(220, "Port command ok, data connection opened");
 }
@@ -661,6 +663,8 @@  bool cConnectionVTP::CmdTUNE(char *Opts)
 	m_LiveStreamer = new cStreamdevLiveStreamer(1);
 	m_LiveStreamer->SetChannel(chan, m_NoTSPIDS ? stTS : stTSPIDS);
 	m_LiveStreamer->SetDevice(dev);
+	m_LiveStreamer->Stop();
+	m_LiveStreamer->Start(m_LiveSocket);
 	
 	return Respond(220, "Channel tuned");
 }