CR: Bug 244764:Serializing and De-seializing job after Launch Capture dialog

[email protected]
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
Synopsis
========
Bug 244764:Serializing and De-seializing job after Launch Capture dialog
causes failure in capture.

Branches: PRODUCER_13_0_RN and HEAD.
Suggested Reviewer: Anyone.


Description
===========
Issue was preview viewere was still holding a reference on job.
Fix was to tell preview viewer to stop preview and not hold reference to
job to before serializing.
Also re-added SetJobIsReady call on new job set and Launch Capture Dialog

Files Affected
==============
client/encodesvc/activex/ctrl/ProducerCtrl.cpp

Testing Performed
=================
Tested in GUI capture to file and Capture to Server jobs and file to file
job.
Encode Job and Launch Capture dialog.


Performance Tests:
- None

Platforms Tested: win32-i386-vc7
Build verified: win32-i386-vc7

QA Hints
========
Please test Launch Capture Dialog with various different jobs.

Index: ProducerCtrl.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/activex/ctrl/ProducerCtrl.cpp,v
retrieving revision 1.3.2.5
diff -u -r1.3.2.5 ProducerCtrl.cpp
--- ProducerCtrl.cpp	27 Jun 2009 07:13:13 -0000	1.3.2.5
+++ ProducerCtrl.cpp	2 Jul 2009 22:45:10 -0000
@@ -1855,6 +1855,11 @@

     res = LoadDeviceDialog( VIDEO_DEVICES, ulDeviceID, bstrDialogName );

+    if (SUCCEEDED(res))
+    {
+	SetJobIsReadyFlag();
+    }
+
     return res;
 }

@@ -6378,11 +6383,7 @@
 	UpdateCodecsInJob();
     }

-    //De-serilize and Serialize on Capture input results in failure.
-    //Bug 244764 hence commenting call to SetJobIsReadyFlag and setting.
-    //m_bIsJobReady to true.
-    //SetJobIsReadyFlag();
-    m_bIsJobReady = TRUE;
+    SetJobIsReadyFlag();

     m_lfJobStartTime = 0;

@@ -6865,6 +6866,8 @@
 CProducerCtrl::SetJobIsReadyFlag()
 {
     HX_RESULT res = HXR_OK;
+    HXBOOL bSubscribedToElapsedDuration = FALSE;
+
     IHXTEncodingJobPtr spJob;

     if (!m_spJob)
@@ -6884,7 +6887,6 @@
 	return res;
     }

-
     //serialize/deserialize the job and depend on the job serialization
code to detect any errors
     //in the job

@@ -6910,13 +6912,26 @@

     if (SUCCEEDED(res))
     {
-	//It is neccessary to un-subscribe from preview to release refrence on
input.
+	//Save current state of m_bSubscribeToElapsedDuration as
UnsubscribeToElapsedDuration will reset it.
+	bSubscribedToElapsedDuration = m_bSubscribeToElapsedDuration;
+
+	//It is neccessary to un-subscribe from preview and stop preview to
release refrence on input.
 	UnsubscribeToElapsedDuration();
+
+	if ((m_bVideoInput == TRUE) &&
+	    ::IsWindow(m_hWnd))
+	{
+	    stopInput();
+	}
+
+        // Make the preview viewer let go of the job
+        m_PreviewViewer.StopPreview();
+        m_PreviewViewer.SetJob(NULL);

 	m_spMediaInputPin = NULL;
 	m_spIMediaSinkInput = NULL;
-
 	m_spJob = NULL;
+
 	BOOL bForceInit = FALSE;
 	res = HXBuildInstanceFromBuffer(m_spFactory,IID_IHXTEncodingJob,
                     pIJobXMLBuffer, spJob.AdoptUnknown(), bForceInit);
@@ -6945,6 +6960,37 @@
 	m_bIsJobReady = FALSE;
     }

+    if (bSubscribedToElapsedDuration)
+    {
+	SubscribeToElapsedDuration();
+    }
+
+    //
+    // Set the new job, and setup the new previews
+    //
+    if (SUCCEEDED(res))
+    {
+	res = m_PreviewViewer.SetJob(m_spJob);
+    }
+
+    //
+    // Start the input
+    //	    NOTE: if it's a file input, this class will be notified when
+    //	    first frame has been received, and input should be closed.
+    //
+    //	    NOTE: we want to try to start input regardless if starting
+    //	    the preview succeeded so that we can show the preview
+    //	    unavail bitmap if necessary
+    //
+    if ((m_bVideoInput == TRUE) &&
+        ::IsWindow(m_hWnd))
+    {
+	startInput();
+    }
+
+    HX_ASSERT(SUCCEEDED(res));
+
+
     return res;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.