Running Skype on an embedded device. Part 1

Hi all, today is a Skype day. I'm working on one, for now a secret :-), project that requires the Skype functionality and I decided to take you along the route with me. The microprocessor architecture I'm using is ARM, strictly speaking OMPA 3530 from Texas Instruments which has the ARM Cortex™-A8 Core with ARMv7, Thumb®-2, NEON™ instruction sets and  520-MHz TMS320C64x+™ DSP Core on the board.

The goal is to write a simple test app that uses the SkypeKit to initiate or receive audio/video calls. The audio will be decoded on the CPU while the video will be in H264 format decoded/encoded on the TMS320 DSP. The rendering will be done directly on the OMAP frame buffer (that means no X server etc). For time being the video capture will be done from a USB webcam which is a temporary solution. The final version will use SoC camera thus not USB.

What is the SkypeKit

The SkypeKit is a software SDK that allows third party developers to integrate the Skype client to their applications or communicate with a standalone version of the well know Skype client application running on the desktop. Skype offers four types of the SkypeKit SDK

  • For embedded devices
    This SDK comes with source code for the Skype API wrapper + binary library with the main Skype runtime. This lib gets linked with your application. These platforms are supported:linux-armv5le-eabi
    linux-armv6le-eabi
    linux-armv7le-eabi
    linux-mips32be
    linux-mips32le
    linux-x86
    mac-x86
    startskypekit.py  (Python)
    windows-x86Apart from the main SkypeKit runtime and the Skype API wrapper there are two more   components that one needs to build. In order to achieve the full audio video communication capabilities one needs to build the audio and video hosts. These hosts run as a standalone processes that communicate with the SkypeKit runtime and provide the audio/video IO including capture and rendering.
  • For desktops
    The same as for the embedded but runs on Windows and Mac. Surprisingly there is no support of the Linux OS.
  • Desktop API for Software
    Text-based command protocol for access to Skype functionality through Skype desktop client. Available for Windows, Linux and Mac. On Windows there is a Skype4COM.dll which basically is the skype client exposed via a COM API.
  • Desktop API for Hardware
    Text-based command protocol for access to Skype functionality through Skype desktop client. Also available for Windows, Linux and Mac. This SDK exposes some API that allows HW such as webcamera, headsets etc to communicate with the skype client.

Skype charges $5 for the SkypeKit SDK for the embedded devices and the same amount $5 for the Desktop one. The SW&HW API SDKs are for free.

Download & installation

The Skype development program is split into the SDK categories and individually priced. http://developer.skype.com/account/tools When you select and pay for the specific development program you get access a project manager which is a place on the skype website where you create projects that use the skype SKDs. The reason for that is that each application running the SkypeKit needs appropriate certificate, either development or production one, and this way it's quite easy to manage which project uses which SDK and which certificate belongs to which project. This is how it looks on the skype website.

Now you can download the SDK and the development key pair which is what most of us would start with. The SDK includes the API wrapper, runtime binary and reference implementations of the audio and video hosts.

I have downloaded the SDK a few months ago but I had to go through different procedure than today. I had to go through a form where I had to select the CPU architecture, and OS type to download the SDK. The API wrapper was offered as a separate download. This time everything is in one archive including runtimes for all platforms.

Since I'm focusing only on the SDK for embedded devices for ARM and Linux OS I'm gonna ignore other platforms and OSs in the rest of this article.

The SkypeKit SDK I'm using is sdp-distro-skypekit_3.7.1.331_1823867.tar.gz

To build the API wrapper unpack the archive in some directory and go straight to the
interfaces/skype/cpp_embedded/build/gmake directory

$ cd sdp-distro-skypekit_3.7.1.331_1823867/interfaces/skype/cpp_embedded/build/gmake

Now you need to setup environment variables for your ARM tool chain which I do by injecting a script referencing my Openembedded sysroot and the gcc toolset to the system environment.

. oe-env-simple.sh

Here is the oe-env-simple.sh script. Note the paths in this script depend on the installation of your Openembedded.

#!/bin/sh -e

OE_HOME_DIR=/attic/angstrom2
OE_BUILD_DIR=${OE_HOME_DIR}/build/tmp-angstrom_2010_x
OE_SYSROOT_BASE=${OE_BUILD_DIR}/sysroots
OE_SYSROOT_TARGET=${OE_SYSROOT_BASE}/armv7a-angstrom-linux-gnueabi
OE_SYSROOT_HOST=${OE_SYSROOT_BASE}/i686-linux
TARGET_TOOL_PREFIX=${OE_SYSROOT_HOST}/usr/armv7a/bin/arm-angstrom-linux-gnueabi

export RANLIB=${TARGET_TOOL_PREFIX}-ranlib
export AS=${TARGET_TOOL_PREFIX}-as
export AR=${TARGET_TOOL_PREFIX}-ar
export CC=${TARGET_TOOL_PREFIX}-gcc
export CXX=${TARGET_TOOL_PREFIX}-g++

# PKG config
export PKG_CONFIG_DISABLE_UNINSTALLED=yes
export PKG_CONFIG_SYSROOT_DIR=${OE_SYSROOT_TARGET}
export PKG_CONFIG_PATH=${OE_SYSROOT_TARGET}/usr/lib/pkgconfig: ${OE_SYSROOT_TARGET}/usr/share/pkgconfig: ${OE_SYSROOT_HOST}/usr/lib/pkgconfig:${OE_SYSROOT_HOST}/usr/share/pkgconfig

#export PATH=${OE_SYSROOT_HOST}/usr/armv7a/bin:${OE_SYSROOT_HOST}/usr/sbin:${OE_SYSROOT_HOST}/usr/bin:${OE_SYSROOT_HOST}/sbin:${OE_SYSROOT_HOST}/bin:${PATH}

For the CodeSourcery Skype suggest to run this

$ cd sdkRoot/interfaces/skype/cpp_embedded/build/gmake
$ make CXX=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-g++ CC=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc

I tried it for my Openembedded tool chain but it didn't work. I guess I would have to specify all env vars from my oe-env-simple.sh on the command line. I haven't spent any time analyzing which variables need to be set and rather used the oe-env-simple.sh I'm using this script every time I need to cross compile something for the ARM and it always works.

All right, now just run 'make' and job done. When the build finishes check out this directory

sdp-distro-skypekit_3.7.1.331_1823867/interfaces/skype/cpp_embedded/build

you should see these binaries

libskypekit-cppwrapper_2_lib.a
libskypekit-cyassl_lib.a
skypekitclient

Ok so we have managed to build the SkypeKit client demo application. The SkypeKit application is dependent to the SkypeKit runtime so we need to start that first. For now we just try to run the client without the audio/video hosts so we expect something to go wrong but hey, let's see what will happen. For the basic testing we use the Skype runtime without the video support. Lets run that.

./linux-armv7-skypekit-voicepcm-novideo

Now we can try to run the skypeclient application. Don't forget to pass the development certificate as a -t parameter.

./skypekitclient -t av_test_arm_v1.pem

Unfortunately after a few seconds the skype runtime gives up and exist with the following error.

SkypeRuntime Copyright (C) 2003-2012 Skype Technologies S.A.
SkypeRuntime Version: 3.7/linux-armv7-skypekit-voicepcm-novideo_3.7.1.341_1823905
Proprietary and confidential, do not share this application.
UnixSocket.cpp:101(Connect): /tmp/pcm_from_skypekit_key: failed to connect: error #111
PCM client connection was not established.

SidPCMClient.cpp:43(SkypePCMInterfaceGet): Skypekit will exit.

The reason is that it expects the audio host but we are not running any. To fix that is a task for next time...

Posted in ARM, Embedded, Skype, Software development, VoIP | 2 Comments

Hello World

Hi all, It has been a dark and mostly cold summer here in Oxford,UK so far but I cannot complain. I have been very busy with many of my projects including fixing up my house so  the bad weather at least distracted me from any holiday thoughts. Thanks to that I have also managed to setup  server hosting and configure this WorldPress-based blog and start writing again. I named this blog "Electron Castle". There is no special meaning behind this name, perhaps just a loose parallel with an atom. The atom could be thought as a castle where electrons live, the same as my various ideas and stories from my life live here. Ok not to imaginative but its cool name anyway:-) Thanks for visiting this this place and I hope you will find something interesting here.

 

Posted in Uncategorized | Leave a comment