<p>To initialize the screen mirroring sink:</p>
-<ol><li><p>To use the functions and data types of the Screen Mirroring Sink API (in <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__MEDIA__SCMIRRORING_SINK__MODULE.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/group__CAPI__MEDIA__SCMIRRORING_SINK__MODULE.html">mobile</a> applications), include the <span style="font-family: Courier New,Courier,monospace"><scmirroring_type.h></span> and <span style="font-family: Courier New,Courier,monospace"><scmirroring_sink.h></span> header files in your application:</p>
+<ol><li><p>To use the functions and data types of the Screen Mirroring Sink API, include the <span style="font-family: Courier New,Courier,monospace"><scmirroring_type.h></span> and <span style="font-family: Courier New,Courier,monospace"><scmirroring_sink.h></span> header files in your application:</p>
<pre class="prettyprint">
#include <scmirroring_type.h>
#include <scmirroring_sink.h>
<p>To handle screen mirroring exceptions:</p>
-<p>If the state callback function returns the <span style="font-family: Courier New,Courier,monospace">SCMIRRORING_STATE_DISCONNECTED</span> state, <a href="#release">release the screen mirroring sink</a>. The situation is caused by the source device as it disconnects the session, or the screen mirroring sink has internal problem.</p>
+<p>If the state callback function returns the error or the <span style="font-family: Courier New,Courier,monospace">SCMIRRORING_STATE_DISCONNECTED</span> state, <a href="#release">release the screen mirroring sink</a>. The situation is caused by the source device as it disconnects the session, or the screen mirroring sink has internal problem.</p>
<pre class="prettyprint">
static void scmirroring_state_callback(scmirroring_error_e error_code, scmirroring_state_e state, void *user_data)
{
int ret;
dlog_print(DLOG_ERROR, LOG_TAG, "Received Callback error code[%d], state[%d]", error_code, state);
+ if(error_code != SCMIRRORING_ERROR_NONE)
+ {
+ ret = destroy_scmirroring_sink(); // see <a href="#release">Releasing Resources</a>
+ if(ret != TRUE)
+ {
+ dlog_print(DLOG_ERROR, LOG_TAG, " destroy_scmirroring_sink fail");
+ return;
+ }
+ }
switch (state)
{