=== added file 'cmake/LinuxCrossCompile.cmake'
--- cmake/LinuxCrossCompile.cmake	1970-01-01 00:00:00 +0000
+++ cmake/LinuxCrossCompile.cmake	2016-02-29 08:26:33 +0000
@@ -0,0 +1,43 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+
+set(AC_NDK_PATH $ENV{AC_NDK_PATH} CACHE STRING "path of mir android bundle")
+
+if (NOT DEFINED AC_TARGET_MACHINE)
+  set(AC_TARGET_MACHINE $ENV{AC_TARGET_MACHINE} CACHE STRING "target machine")
+endif()
+if (NOT DEFINED AC_GCC_VARIANT)
+  set(AC_GCC_VARIANT $ENV{AC_GCC_VARIANT} CACHE STRING "gcc variant required")
+endif()
+
+set(CMAKE_C_COMPILER   /usr/bin/${AC_TARGET_MACHINE}-gcc${AC_GCC_VARIANT})
+set(CMAKE_CXX_COMPILER /usr/bin/${AC_TARGET_MACHINE}-g++${AC_GCC_VARIANT})
+
+# where to look to find dependencies in the target environment
+set(CMAKE_FIND_ROOT_PATH  "${AC_NDK_PATH}")
+
+#treat the chroot's includes as system includes
+include_directories(SYSTEM "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}")
+list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}" )
+
+# Add the chroot libraries as system libraries
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+  "${AC_NDK_PATH}/lib"
+  "${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}"
+  "${AC_NDK_PATH}/usr/lib"
+  "${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}"
+)
+
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,-rpath-link,")
+set(CMAKE_INSTALL_RPATH "${AC_NDK_PATH}/lib:${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}:${AC_NDK_PATH}/usr/lib:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}")
+
+set(ENV{PKG_CONFIG_PATH} "${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}/pkgconfig")
+set(ENV{PKG_CONFIG_SYSROOT_DIR} "${AC_NDK_PATH}")
+
+#use only the cross compile system
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

=== added file 'cross-compile-chroot.sh'
--- cross-compile-chroot.sh	1970-01-01 00:00:00 +0000
+++ cross-compile-chroot.sh	2016-02-29 08:26:33 +0000
@@ -0,0 +1,162 @@
+#!/bin/bash
+# build script to compile Aethercast for armhf devices
+#
+set -e
+
+usage() {
+  echo "usage: $(basename $0) [-a <arch>] [-c] [-h] [-d <dist>] [-u]"
+  echo "  -a <arch>  Specify target architecture (armhf/arm64/powerpc/ppc64el/amd64/i386/host)"
+  echo "  -c         Clean before building"
+  echo "  -d <dist>  Select the distribution to build for (vivid/wily/xenial)"
+  echo "  -h         This message"
+  echo "  -u         Update partial chroot directory"
+}
+
+clean_build_dir() {
+    rm -rf ${1}
+    mkdir ${1}
+}
+
+# Default to a dist-agnostic directory name so as to not break Jenkins right now
+BUILD_DIR=build-android-arm
+NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 ))
+_do_update_chroot=0
+
+# Default to vivid as we don't seem to have any working wily devices right now 
+dist=vivid
+clean=0
+update_build_dir=0
+
+target_arch=armhf
+
+while getopts "a:cd:hu" OPTNAME
+do
+    case $OPTNAME in
+      a )
+        target_arch=${OPTARG}
+        update_build_dir=1
+        ;;
+      c )
+        clean=1
+        ;;
+      d )
+        dist=${OPTARG}
+        update_build_dir=1
+        ;;
+      u )
+        _do_update_chroot=1
+        ;;
+      h )
+        usage
+        exit 0
+        ;;
+      : )
+        echo "Parameter -${OPTARG} needs an argument"
+        usage
+        exit 1;
+        ;;
+      * )
+        echo "invalid option specified"
+        usage
+        exit 1
+        ;;
+    esac
+done
+
+shift $((${OPTIND}-1))
+
+if [ "${target_arch}" = "host" ]; then
+    target_arch=`dpkg-architecture -qDEB_HOST_ARCH`
+fi
+
+if [ ${clean} -ne 0 ]; then
+    clean_build_dir ${BUILD_DIR}
+fi
+
+if [ ${update_build_dir} -eq 1 ]; then
+    BUILD_DIR=build-${target_arch}-${dist}
+fi
+
+if [ "${AC_NDK_PATH}" = "" ]; then
+    export AC_NDK_PATH=~/.cache/aethercast-${target_arch}-chroot-${dist}
+fi
+
+if [ ! -d ${AC_NDK_PATH} ]; then 
+    echo "no partial chroot dir detected. attempting to create one"
+    _do_update_chroot=1
+fi
+
+if [ ! -d ${BUILD_DIR} ]; then 
+    mkdir ${BUILD_DIR}
+fi
+
+echo "Building for distro: $dist"
+echo "Using AC_NDK_PATH: ${AC_NDK_PATH}"
+
+additional_repositories=
+if [ ${dist} == "vivid" ] ; then
+    additional_repositories="-r http://ppa.launchpad.net/ci-train-ppa-service/stable-phone-overlay/ubuntu -r http://ppa.launchpad.net/ci-train-ppa-service/landing-000/ubuntu"
+fi
+
+gcc_variant=
+if [ "${dist}" = "vivid" ]; then
+    gcc_variant=-4.9
+fi
+
+case ${target_arch} in
+    armhf )
+        target_machine=arm-linux-gnueabihf
+        ;;
+    amd64 )
+        target_machine=x86_64-linux-gnu
+        ;;
+    i386 )
+        target_machine=i386-linux-gnu
+        ;;
+    arm64 )
+        target_machine=aarch64-linux-gnu
+        ;;
+    ppc64el )
+        target_machine=powerpc64le-linux-gnu
+        ;;
+    powerpc )
+        target_machine=powerpc-linux-gnu
+        ;;
+    * )
+        # A good guess (assuming you have dpkg-architecture)
+        target_machine=`dpkg-architecture -A${target_arch} -qDEB_HOST_MULTIARCH` || {
+            echo "Unknown architecture ${target_arch}"
+            usage
+            exit 1
+        }
+        ;;
+esac
+
+echo "Target architecture: ${target_arch}"
+echo "Target machine: ${target_machine}"
+
+if [ ${_do_update_chroot} -eq 1 ] ; then
+    pushd scripts > /dev/null
+        ./setup-partial-armhf-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH}
+    popd > /dev/null
+    # force a clean build after an update, since CMake cache maybe out of date
+    clean_build_dir ${BUILD_DIR}
+fi
+
+pushd ${BUILD_DIR} > /dev/null
+
+    export PKG_CONFIG_PATH="${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${target_machine}/pkgconfig"
+    export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
+    export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
+    export PKG_CONFIG_SYSROOT_DIR=$AC_NDK_PATH
+    export PKG_CONFIG_EXECUTABLE=`which pkg-config`
+    export AC_TARGET_MACHINE=${target_machine}
+    export AC_GCC_VARIANT=${gcc_variant}
+    echo "Using PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
+    echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"
+    cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \
+      ..
+
+    make -j${NUM_JOBS} $@
+
+popd > /dev/null

=== modified file 'debian/control'
--- debian/control	2016-01-21 11:13:32 +0000
+++ debian/control	2016-02-29 08:26:33 +0000
@@ -20,7 +20,8 @@
                libgtest-dev,
                libreadline-dev,
                libreadline6-dev,
-               libwds-dev
+               libwds-dev,
+               pkg-config
 Standards-Version: 3.9.4
 Homepage: http://launchpad.net/aethercast
 # If you aren't a member of ~phablet-team but need to upload packaging changes,

=== added directory 'scripts'
=== added file 'scripts/setup-partial-armhf-chroot.sh'
--- scripts/setup-partial-armhf-chroot.sh	1970-01-01 00:00:00 +0000
+++ scripts/setup-partial-armhf-chroot.sh	2016-02-29 08:26:33 +0000
@@ -0,0 +1,155 @@
+#!/bin/bash
+#
+# TODO: Rename this file without "armhf" when it's safe to do so.
+#
+
+set -e
+
+name=${0}
+
+usage() {
+    echo "Usage: ${name} [options] mychroot-dir"
+    echo "options:"
+    echo "	-a arch	Select architecture, i.e. armhf, arm64, ppc... Default is armhf"
+    echo "	-d dist	Select distribution, i.e. vivid, wily. Default is vivid"
+    echo "	-r rep	Select an additional repository for bootstrap. Default is none"
+    echo
+    echo "please supply at least a directory to create partial chroot in. (eg, ./setup-partial-armhf-chroot.sh mychroot-dir)"
+}
+
+# Default to vivid as we don't seem to have any working wily devices right now.
+# Also Jenkins expects this script to default to vivid (TODO: update CI?)
+arch=armhf
+dist=vivid
+sourceid=0
+repositories=
+sources=
+
+while getopts a:d:r:h opt; do
+    case $opt in
+        a)
+            arch=$OPTARG
+            ;;
+        d)
+            dist=$OPTARG
+            ;;
+        r)
+            repositories="$repositories $OPTARG"
+            ((++sourceid))
+            sources="$sources source$sourceid"
+            ;;
+        :)
+            echo "Option -$OPTARG requires an argument" 
+            usage
+            exit 1
+            ;;
+        h)
+            usage
+            exit 0
+            ;;
+        \?)
+            echo "Invalid option: -$OPTARG" 
+            usage
+            exit 1
+            ;;
+    esac
+done
+
+shift $((OPTIND-1))
+
+if [ -z ${1} ]; then
+    usage
+    exit 1
+fi
+
+directory=${1}
+echo "creating phablet-compatible $arch partial chroot for aethercast compilation in directory ${directory}"
+
+if [ ! -d ${directory} ]; then
+    mkdir -p ${directory} 
+fi
+
+DEBCONTROL=$(pwd)/../debian/control
+
+pushd ${directory} > /dev/null
+
+# Empty dpkg status file, so that ALL dependencies are listed with dpkg-checkbuilddeps
+echo "" > status
+
+# Manual error code checking is needed for dpkg-checkbuilddeps
+set +e
+
+# Parse dependencies from debian/control
+# dpkg-checkbuilddeps returns non-zero when dependencies are not met and the list is sent to stderr
+builddeps=$(dpkg-checkbuilddeps -a ${arch} --admindir=. ${DEBCONTROL} 2>&1 )
+if [ $? -eq 0 ] ; then
+    exit 0 
+fi
+echo "${builddeps}"
+
+# now turn exit on error option
+set -e
+
+# Sanitize dependencies list for submission to multistrap
+# build-essential is not needed as we are cross-compiling
+builddeps=$(echo ${builddeps} | sed -e 's/dpkg-checkbuilddeps://g' \
+                                    -e 's/error://g' \
+                                    -e 's/Unmet build dependencies://g' \
+                                    -e 's/build-essential:native//g')
+builddeps=$(echo ${builddeps} | sed 's/([^)]*)//g')
+builddeps=$(echo ${builddeps} | sed -e 's/abi-compliance-checker//g')
+builddeps=$(echo ${builddeps} | sed -e 's/multistrap//g')
+
+case ${arch} in
+    amd64 | i386 )
+        source_url=http://archive.ubuntu.com/ubuntu
+        ;;
+    * )
+        source_url=http://ports.ubuntu.com/ubuntu-ports
+        ;;
+esac
+
+echo "[General]
+arch=${arch}
+directory=${directory}
+unpack=false
+noauth=true
+bootstrap=Ubuntu ${sources}
+
+[Ubuntu]
+packages=${builddeps}
+source=${source_url}
+suite=${dist}
+" > mstrap.conf
+
+sourceid=0
+for x in ${repositories};
+do
+    ((++sourceid))
+    echo "[source${sourceid}]
+source=${x}
+suite=${dist}
+" >> mstrap.conf
+done
+
+multistrap -f mstrap.conf 
+
+rm -f var/cache/apt/archives/lock
+
+# Remove libc libraries that confuse the cross-compiler
+rm -f var/cache/apt/archives/libc-dev*.deb
+rm -f var/cache/apt/archives/libc6*.deb
+
+for deb in var/cache/apt/archives/* ; do
+    if [ ! -d ${deb} ] ; then
+        echo "unpacking: ${deb}"
+        dpkg -x ${deb} .
+    fi
+done
+
+# Fix up symlinks which asssumed the usual root path
+for broken_symlink in $(find . -name \*.so -type l -xtype l) ; do
+    ln -sf $(pwd)$(readlink ${broken_symlink}) ${broken_symlink}
+done
+
+popd > /dev/null 

=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	2016-01-21 13:25:31 +0000
+++ src/CMakeLists.txt	2016-02-29 08:26:33 +0000
@@ -27,15 +27,15 @@
 configure_file(w11tng/config.h.in w11tng/config.h @ONLY)
 
 set(HEADERS
-    mcs/ip_v4_address.h
-    mcs/keep_alive.h
-    mcs/mac_address.h
-    mcs/types.h
-    mcs/shared_gobject.h
-    mcs/keep_alive.h
+  mcs/ip_v4_address.h
+  mcs/keep_alive.h
+  mcs/mac_address.h
+  mcs/types.h
+  mcs/shared_gobject.h
+  mcs/keep_alive.h
+  mcs/config.h
 
-    mcs/config.h
-    w11tng/config.h
+  w11tng/config.h
 )
 
 set(SOURCES
@@ -83,13 +83,6 @@
   w11tng/hostname1stub.cpp
 )
 
-link_directories(
-  ${GLIB_LIBRARY_DIRS}
-  ${GIO_LIBRARY_DIRS}
-  ${GIO-UNIX_LIBRARY_DIRS}
-  ${WDS_LIBRARY_DIRS}
-)
-
 include_directories(
   ${Boost_INCLUDE_DIRS}
   ${GLIB_INCLUDE_DIRS}
@@ -106,12 +99,18 @@
 add_executable(aethercast mcs/main.cpp)
 
 target_link_libraries(aethercast-core
+  ${Boost_LDFLAGS}
   ${Boost_LIBRARIES}
+  ${GLIB_LDFLAGS}
   ${GLIB_LIBRARIES}
+  ${GIO_LDFLAGS}
   ${GIO_LIBRARIES}
+  ${GIO-UNIX_LDFLAGS}
   ${GIO-UNIX_LIBRARIES}
+  ${GST_LDFLAGS}
   ${GST_LIBRARIES}
   ${CMAKE_THREAD_LIBS_INIT}
+  ${WDS_LDFLAGS}
   ${WDS_LIBRARIES}
   -ldl
 )

=== modified file 'src/mcs/basesourcemediamanager.cpp'
--- src/mcs/basesourcemediamanager.cpp	2015-12-07 16:02:43 +0000
+++ src/mcs/basesourcemediamanager.cpp	2016-02-29 08:26:33 +0000
@@ -20,7 +20,15 @@
 #include "basesourcemediamanager.h"
 #include "logger.h"
 
+namespace {
+static unsigned int next_session_id = 0;
+}
+
 namespace mcs {
+BaseSourceMediaManager::BaseSourceMediaManager() :
+    session_id_(++next_session_id) {
+}
+
 wds::SessionType BaseSourceMediaManager::GetSessionType() const {
     return wds::VideoSession;
 }
@@ -102,4 +110,8 @@
 void BaseSourceMediaManager::SendIDRPicture() {
     WARNING("Unimplemented IDR picture request");
 }
+
+std::string BaseSourceMediaManager::GetSessionId() const {
+    return mcs::Utils::Sprintf("%d", session_id_);
+}
 } // namespace mcs

=== modified file 'src/mcs/basesourcemediamanager.h'
--- src/mcs/basesourcemediamanager.h	2015-11-26 16:48:53 +0000
+++ src/mcs/basesourcemediamanager.h	2016-02-29 08:26:33 +0000
@@ -24,6 +24,8 @@
 class BaseSourceMediaManager : public wds::SourceMediaManager
 {
 public:
+    explicit BaseSourceMediaManager();
+
     void SetSinkRtpPorts(int port1, int port2) override;
     std::pair<int,int> GetSinkRtpPorts() const override;
     int GetLocalRtpPort() const override;
@@ -35,6 +37,7 @@
     bool InitOptimalAudioFormat(const std::vector<wds::AudioCodec>& sink_supported_codecs) override;
     wds::AudioCodec GetOptimalAudioFormat() const override;
     void SendIDRPicture() override;
+    std::string GetSessionId() const override;
 
 protected:
     virtual void Configure() = 0;
@@ -43,6 +46,7 @@
     int sink_port1_;
     int sink_port2_;
     wds::H264VideoFormat format_;
+    unsigned int session_id_;
 };
 } // namespace mcs
 #endif

=== modified file 'src/mcs/miracastsourceclient.cpp'
--- src/mcs/miracastsourceclient.cpp	2015-12-09 16:07:13 +0000
+++ src/mcs/miracastsourceclient.cpp	2016-02-29 08:26:33 +0000
@@ -85,6 +85,14 @@
     return local_address_;
 }
 
+int MiracastSourceClient::GetNextCSeq(int *initial_peer_cseq) const {
+    static int send_cseq = 0;
+    ++send_cseq;
+    if (initial_peer_cseq && send_cseq == *initial_peer_cseq)
+        send_cseq *= 2;
+    return send_cseq;
+}
+
 class TimerCallbackData {
 public:
     TimerCallbackData(MiracastSourceClient *delegate) :

=== modified file 'src/mcs/miracastsourceclient.h'
--- src/mcs/miracastsourceclient.h	2015-12-07 09:07:50 +0000
+++ src/mcs/miracastsourceclient.h	2016-02-29 08:26:33 +0000
@@ -57,6 +57,7 @@
     std::string GetLocalIPAddress() const override;
     uint CreateTimer(int seconds) override;
     void ReleaseTimer(uint timerId) override;
+    int GetNextCSeq(int* initial_peer_cseq = nullptr) const override;
 
 public:
     static gboolean OnTimeout(gpointer user_data);

