Package: t38modem
Version: 2.0.0-3
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu raring ubuntu-patch

The two patches here should be reasonably self-explanatory, though
this was a "blind" porting effort on my part, based on reading the
API changes in opal 3.10.7 and 3.10.9 and adjusting the t38modem 
sources accordingly, so a second set of eyes would be appreciated.

Once you're satisfied with these patches (or have fixed them as
you see fit), an upload to experimental to match the new opal/ptlib
might not be a bad plan.

... Adam

-- System Information:
Debian Release: wheezy/sid
  APT prefers raring-updates
  APT policy: (500, 'raring-updates'), (500, 'raring-security'), (500, 'raring')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7.0-5-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru t38modem-2.0.0/debian/changelog t38modem-2.0.0/debian/changelog
diff -Nru t38modem-2.0.0/debian/patches/opal-3.10.7.patch t38modem-2.0.0/debian/patches/opal-3.10.7.patch
--- t38modem-2.0.0/debian/patches/opal-3.10.7.patch	1969-12-31 17:00:00.000000000 -0700
+++ t38modem-2.0.0/debian/patches/opal-3.10.7.patch	2012-11-07 14:25:18.000000000 -0700
@@ -0,0 +1,104 @@
+Description: Fix FTBS with the new opal 3.10.7 API
+Author: Adam Conrad <[email protected]>
+Forwarded: no
+
+Index: t38modem-2.0.0/opal/modemstrm.h
+===================================================================
+--- t38modem-2.0.0.orig/opal/modemstrm.h	2012-11-07 14:04:57.000000000 -0700
++++ t38modem-2.0.0/opal/modemstrm.h	2012-11-07 14:25:13.652310704 -0700
+@@ -74,7 +74,6 @@
+   /**@name Overrides of OpalRawMediaStream class */
+   //@{
+     virtual PBoolean Open();
+-    virtual PBoolean Close();
+ 
+     virtual PBoolean ReadData(
+       BYTE * data,                         ///<  Data buffer to read to
+@@ -92,6 +91,8 @@
+   //@}
+ 
+   protected:
++    virtual void InternalClose();
++
+     AudioEngine *audioEngine;
+ };
+ /////////////////////////////////////////////////////////////////////////////
+@@ -118,7 +119,6 @@
+   /**@name Overrides of OpalMediaStream class */
+   //@{
+     virtual PBoolean Open();
+-    virtual PBoolean Close();
+     virtual void OnStartMediaPatch();
+ 
+     virtual PBoolean ReadPacket(
+@@ -133,6 +133,8 @@
+   //@}
+ 
+   protected:
++    virtual void InternalClose();
++
+     long currentSequenceNumber;
+ #if PTRACING
+     int totallost;
+Index: t38modem-2.0.0/opal/modemstrm.cxx
+===================================================================
+--- t38modem-2.0.0.orig/opal/modemstrm.cxx	2012-11-07 14:04:57.000000000 -0700
++++ t38modem-2.0.0/opal/modemstrm.cxx	2012-11-07 14:23:17.168310353 -0700
+@@ -110,18 +110,16 @@
+   return OpalMediaStream::Open();
+ }
+ 
+-PBoolean AudioModemMediaStream::Close()
++void AudioModemMediaStream::InternalClose()
+ {
+   if (isOpen) {
+-    PTRACE(3, "AudioModemMediaStream::Close " << *this);
++    PTRACE(3, "AudioModemMediaStream::InternalClose " << *this);
+ 
+     if (IsSink())
+       audioEngine->CloseIn(EngineBase::HOWNERIN(this));
+     else
+       audioEngine->CloseOut(EngineBase::HOWNEROUT(this));
+   }
+-
+-  return OpalMediaStream::Close();
+ }
+ 
+ PBoolean AudioModemMediaStream::ReadData(BYTE * data, PINDEX size, PINDEX & length)
+@@ -188,31 +186,30 @@
+   return OpalMediaStream::Open();
+ }
+ 
+-PBoolean T38ModemMediaStream::Close()
++void T38ModemMediaStream::InternalClose()
+ {
+   if (isOpen) {
+-    PTRACE(3, "T38ModemMediaStream::Close " << *this);
++    PTRACE(3, "T38ModemMediaStream::InternalClose " << *this);
+ 
+     if (IsSink()) {
+-      PTRACE(2, "T38ModemMediaStream::Close Send statistics:"
++      PTRACE(2, "T38ModemMediaStream::InternalClose Send statistics:"
+                 " sequence=" << currentSequenceNumber <<
+                 " lost=" << totallost);
+ 
+       t38engine->CloseIn(EngineBase::HOWNERIN(this));
+     } else {
+-      PTRACE(2, "T38ModemMediaStream::Close Receive statistics:"
++      PTRACE(2, "T38ModemMediaStream::InternalClose Receive statistics:"
+                 " sequence=" << currentSequenceNumber);
+ 
+       t38engine->CloseOut(EngineBase::HOWNEROUT(this));
+     }
+   }
+-
+-  return OpalMediaStream::Close();
+ }
+ 
+ void T38ModemMediaStream::OnStartMediaPatch()
+ {
+   if (isSource) {
++    PatchPtr mediaPatch = m_mediaPatch;
+     if (mediaPatch != NULL) {
+       OpalMediaStreamPtr sink = mediaPatch->GetSink();
+ 
diff -Nru t38modem-2.0.0/debian/patches/opal-3.10.9.patch t38modem-2.0.0/debian/patches/opal-3.10.9.patch
--- t38modem-2.0.0/debian/patches/opal-3.10.9.patch	1969-12-31 17:00:00.000000000 -0700
+++ t38modem-2.0.0/debian/patches/opal-3.10.9.patch	2012-12-12 15:07:11.000000000 -0700
@@ -0,0 +1,84 @@
+Description: Fix FTBS with the new opal 3.10.9 API
+Author: Adam Conrad <[email protected]>
+Forwarded: no
+
+Index: t38modem-2.0.0/opal/sipep.cxx
+===================================================================
+--- t38modem-2.0.0.orig/opal/sipep.cxx	2012-12-12 14:59:13.000000000 -0700
++++ t38modem-2.0.0/opal/sipep.cxx	2012-12-12 15:06:56.819887272 -0700
+@@ -167,11 +167,12 @@
+     virtual void OnApplyStringOptions();
+ 
+     virtual bool SwitchFaxMediaStreams(
+-      bool enableFax                            ///< Enable FAX or return to audio mode
++      bool toT38                                ///< Enable FAX or return to audio mode
+     );
+ 
+     virtual void OnSwitchedFaxMediaStreams(
+-      bool enabledFax                           ///< Enabled FAX or audio mode
++      bool toT38,                               ///< Enabled FAX or audio mode
++      bool success                              ///< Switch succeeded or failed
+     );
+ 
+     virtual PBoolean OnOpenMediaStream(
+@@ -507,15 +508,15 @@
+   return res;
+ }
+ 
+-void MySIPConnection::OnSwitchedFaxMediaStreams(bool enabledFax)
++void MySIPConnection::OnSwitchedFaxMediaStreams(bool toT38, bool success)
+ {
+   PTRACE(3, "MySIPConnection::OnSwitchedFaxMediaStreams: "
+-         << (enabledFax == switchingToFaxMode ? "" : "NOT ") << "switched to "
+-         << (switchingToFaxMode ? "fax" : "audio"));
++         << (success ? "succeeded" : "NOT") << "switched to "
++         << (toT38 ? "T.38" : "audio"));
+ 
+-  SIPConnection::OnSwitchedFaxMediaStreams(enabledFax);
++  SIPConnection::OnSwitchedFaxMediaStreams(toT38, success);
+ 
+-  if (switchingToFaxMode && !enabledFax) {
++  if (toT38 && !success) {
+       PTRACE(3, "MySIPConnection::OnSwitchedFaxMediaStreams: fallback to audio");
+       mediaFormatList -= OpalT38;
+       SwitchFaxMediaStreams(false);
+Index: t38modem-2.0.0/opal/h323ep.cxx
+===================================================================
+--- t38modem-2.0.0.orig/opal/h323ep.cxx	2012-12-12 14:59:13.000000000 -0700
++++ t38modem-2.0.0/opal/h323ep.cxx	2012-12-12 15:07:09.307887150 -0700
+@@ -176,11 +176,12 @@
+     );
+ 
+     virtual bool SwitchFaxMediaStreams(
+-      bool enableFax                           ///< Enable FAX or return to audio mode
++      bool toT38                               ///< Enable FAX or return to audio mode
+     );
+ 
+     virtual void OnSwitchedFaxMediaStreams(
+-      bool enabledFax                          ///< Enabled FAX or audio mode
++      bool toT38,                              ///< Enabled FAX or audio mode
++      bool success                             ///< Switch succeeded or failed
+     );
+ 
+     virtual PBoolean OnOpenMediaStream(
+@@ -567,15 +568,15 @@
+   return false;
+ }
+ 
+-void MyH323Connection::OnSwitchedFaxMediaStreams(bool enabledFax)
++void MyH323Connection::OnSwitchedFaxMediaStreams(bool toT38, bool success)
+ {
+   PTRACE(3, "MyH323Connection::OnSwitchedFaxMediaStreams: "
+-         << (enabledFax == switchingToFaxMode ? "" : "NOT ") << "switched to "
+-         << (switchingToFaxMode ? "fax" : "audio"));
++         << (success ? "succeeded" : "NOT") << "switched to "
++         << (toT38 ? "T.38" : "audio"));
+ 
+-  H323Connection::OnSwitchedFaxMediaStreams(enabledFax);
++  H323Connection::OnSwitchedFaxMediaStreams(toT38, success);
+ 
+-  if (switchingToFaxMode && !enabledFax) {
++  if (toT38 && !success) {
+       PTRACE(3, "MyH323Connection::OnSwitchedFaxMediaStreams: fallback to audio");
+       mediaFormatList -= OpalT38;
+       SwitchFaxMediaStreams(false);
diff -Nru t38modem-2.0.0/debian/patches/series t38modem-2.0.0/debian/patches/series
--- t38modem-2.0.0/debian/patches/series	2012-02-08 19:51:46.000000000 -0700
+++ t38modem-2.0.0/debian/patches/series	2012-12-12 14:38:56.000000000 -0700
@@ -1,3 +1,5 @@
 simplify-makefile-new
 t38modem-opal3.10-patch
 spelling-error-fix
+opal-3.10.7.patch
+opal-3.10.9.patch

Reply via email to