示例#1
0
        SendMediaPlayerCommand(
            DUCE.Channel channel,
            DUCE.ResourceHandle handle,
            bool notifyUceDirectly
            )
        {
//
// This is an interrop call, but, it does not set a last error being a COM call. So, suppress the
// presharp warning about losing last error.
//
#pragma warning disable 6523

            //
            // AddRef to ensure the media player stays alive during transport, even if the
            // MediaPlayer goes away.  The slave video resource takes ownership of this AddRef.
            // Note there is still a gray danger zone here -- if the channel command is lost
            // this reference won't be cleaned up.
            //
            // MediaPlayer: AddRef on nativeMedia may be lost if the channel send command fails
            //
            // There is no point in addrefing the native media if we are going remote since
            // we will send null.
            //
            UnsafeNativeMethods.MILUnknown.AddRef(_nativeMedia);

            channel.SendCommandMedia(
                handle,
                _nativeMedia,
                notifyUceDirectly
                );

#pragma warning restore 6523
        }