WWDC2003 Session 727
Transcript
Kind: captions
Language: en
welcome to the quicktime streaming
server programming session and we'll be
covering the quicktime streaming server
and darwin streaming server source code
and API programming one of the things
that will be covering is how you add to
nad your code to create your own server
or modify the existing servers that is
available and when you use darwin
streaming server source you end up with
a server that it can run on linux OS 10
bsd solaris and windows NT so there's
forced features that we're going to
cover we're be talking about the server
architecture and there's other types of
products applications inside the source
code when you download it that will be
covering finally building installing and
a few debugging tips at the end and one
of the things about this session that is
a little bit different from previous API
sessions that has been done with the
QuickTime streaming server is this is an
open source project so yes there is the
API and there are times when you have a
module that you want to write and there
are other times when you just want to
change some small behavior that's in the
server or fix something that you think
isn't done right and because it's open
source you can just go in there and
change that code so to help you do that
we'll be talking about how the
architecture the server and how you can
go ahead and change the behavior or add
behaviors to it and because this is open
source it is covered under the apple
public source license to a psl you can
find it up on the web you want to
download this and read it carefully
follow the terms of the license then
plan your changes and your addition
great go ahead create your software if
you find that you've had to modify the
server you will want to post that you
have modified the server and make those
changes
public so that was our message for my
response to the source that will be
talking about is the server of course
you have your server modules inside the
server there are files that are specific
to porting the code to Windows NT or
Linux you'll want to take a look at
those if you have different OS than the
ones that are already supported in the
build of the server you have the various
protocols that are supported inside the
server so these files will be a bit are
there when you download the source and
there's a client development library we
use this library in our product in the
QuickTime streaming server and it
basically gives you rtsp over RTP as a
client some PCP skip detection if you
want to see what a skip protection
implementation looks like on from a
science point of view there's artistic
client library in the source code
there's a proxy server there's mp3 and
mpeg-4 file broadcasters you have the
file parsing and reading code that's
inside we need the source code when you
download it and of course we have our
web based server you I that's part of
the Darwin streaming server product so
all of these are available for you to
look at use it at sample code or go
ahead and change it modify it to
whatever needs that you have this is a
diagram high level diagram of server and
how it works and it is a module based
server there's very little actually that
the core server does it's just basically
there to run the modules and execute
tasks those tasks are actually
implemented each of the modules that is
loaded it into the server so we start
out with our clients connecting to the
server over the network protocol on the
other end is the key gssapi that's going
to go ahead and call your module
now this is the core server the
execution of the core server there's one
process and it contains four main
threats the one main main thread is
simply there to watch the state of the
server and gather statistics so it's
actually doing very little there is an
event threat that's out there using
select on linux and POSIX Kazakh systems
it's using Windows Windows messages and
macros head event queue to find out if
there's a vent that he needs to process
and once an event happens like a reed
event it will then go ahead find a task
that's associated with that file
descriptor and it's going to put it on
something called to task for it the tax
rate is actually going to do the work so
the vet thread accurate browser event
throws it onto at a thread is simply
going to go back to sleep again waiting
for another event so there's just one
event thread and all the work is done by
the passwords those threads are going to
be running through their cues one at a
time and processing each task so some
servers out there will throw off our
fourth process for every request our
server the QuickTime streaming server /
star which gaming server has two threads
there's I mean processes there is parent
process which like the main thread is
just checking the status of something
else in this case it's the child process
so it Forks off the child process and
just wait to see if the child process
has died in the case of some unknown
reason the child process were to be
killed or crash perhaps the parent
process will go ahead and be executed
now the child process is the server that
we were just looking at and it contains
the task Reds events resume
red and the idol class hood which is a
variation on the task but there's only
one task threads per processor so that
means all the work is really generally
being done on one thread and this may
mean that if you have a module or if
you're doing something in the server and
it's going to take a long time what you
want to do is possibly create your own
private thread and let's take a look at
how these threads can affect a module or
processing inside the server so let's
switch over to demo one and I'm going to
run a file module that I have modified
and what this module is going to be
doing is blocking in order to do some
long task maybe what you can imagine
it's doing is downloading a file from
another server before constraint so a
request comes in and it's going to have
to download it first so I'm going to
open up a just a regular movie saw here
now I'm going to call my special module
that's going to go off and do some work
so here it is and it's busy downloading
this file and it's doing it in this is
just a tight loop just going to block
the whole server because it's only the
one test fit and it says okay when I'm
done then I'm going to return from the
service call into the module and respond
to the request and you can see at that
point what had happened to the previous
client who was busy watching was that
they was frozen so the server API does
support having a module take a little
while to do things and the way we do
that is we provide a call called set
idle timer which is going to tell the
server
to call it again because it is me doing
some work so in this case yes this nemoj
it might be busy downloading something
copy a file it could be doing a DNS
lookup which is completely blocking a
server but at least the whole server
isn't frozen so this is one of those
things you have to be aware of when
you're working in the server code now
there is one last thing on a show you
and that is what happens if you're going
to make a call maybe it's get host by
name that where it's going to go and you
have no control over when it's going to
come back it could be 10 seconds from
now how do you deal with that since you
can't at in the middle of the call
return control back to the server but
you need to do then is forked off your
own thread now the potentium service
source code has and I was grad class so
I just decided to use that and what I
did was I just instantiated the thread
and told it to go ahead and make my
blocking call so so in this case I have
a tight loop but normally would be
blocking the entire server however in
this case because it's on its own thread
I can still play movies so just
something to think about there is in
most cases you won't have to deal with
any of these issues but if you do find
yourself having to do something that's
going to take a little while a long
while it would be a bad thing block the
entire server so this is basically the
the architecture of the server and let's
switch back to slides
so the reason for the number of threads
was to keep our thread count low and
this is a performance optimization in
the server and the same idea is true
when it comes to having only one process
it the server runs after it is much more
efficient to have fewer numbers of
threads it just means that as a
programmer you have to be aware of this
architecture and design appropriately so
let's take a look at the core server now
we have a few main objects that you're
going to see two in the core server and
the first one is the two TS s server
this is face the class that's going to
get infatuated and it's going to load up
each of the modules and execute them
there are the callbacks this is the API
so every time a module makes a cute ESS
API call back into the server it's
implemented in something called GTFS
call back we have cute ESS dictionaries
in the core server these are data
storage it's a key look up with the
values associated with the key the GTS s
dictionary it once again is there to
support the API we have rtsp sessions
which is the artistic protocol with the
server supports and various other files
associated with rtsp that protocol
parsing and formatting there's RTP
session yet another protocol class and
its support finally we have server
preferences that basically configure the
server when it starts up so all of this
actually could be summarized that there
is a QT SS server class it's going to
load up your modules there's some API
support classes that provide your
modules with callbacks into roll calls
into the module and call back from them
and protocol support inside the core
server followed by configuration
preferences
this is an example of the file module
every time we request a movie from the
Dharma streaming server it's going to go
through a series of calls into the file
module in this case normally when you're
looking at our API you're seeing the
right hand side of this diagram which is
the world calls that this module will be
getting called in and these are the
times in which the module gets called
what that meat is on the server side is
the Qt SS server which we said owns the
modules loads them up is going to
initialize the module when it first
starts up and after that the module has
already decided it wants to handle rtsp
requests and has told the server that in
the register role that if there's an
rtsp request coming in I want to see it
and I want to be able to process that so
when an rtsp session gets an issue
initialize on the server from an
incoming client it's going to go ahead
and call into this particular module to
handle the request in this case let's
say it was a play request the modules
going to take that process it call it
back into the server it's going to use
which will go to the rtsp session and in
doing a art by QT SS play call back this
is going to kick off the rtsp session
with clients what that means is now the
server is ready to call the to respond
to the client with the play request
response and then start calling into
this module 2 4 packets and so the next
roll call that this module starts
receiving from the server is going to be
the same package will basically the
server is going to keep saying give me a
package give me a packet and the module
in that role call is going to go out
find a packet for each of the streams
and do a cute ESS right so this covers
pretty much a basic module it's going to
get loaded it's going to
say these are the roles that I want to
support its going to get called in those
roles and it's going to call back into
the server after it's done processing so
there are a number of modules that are
pre-built into the server when you
launch the server there's several
modules and I've categorized them by
content support and access control now
what we have is the content modules here
which starts with the file module this
is your basic module that is going to do
mpeg-4 streaming it's going to do 3gp
support it does QuickTime movie file
support it handles describes for rtsp
basically it's and when it starts up
this was we were seeing before it's
going to say I want to handle rtsp
requests and I want to stream out
package so it's going to do those two
roll calls the reflector module doesn't
have the files what it does handle is
incoming broadcast live streams it binds
to a port it handles requests for ftp
files which been the reflector modules
when it comes time to write packets is
going to be pulling in from an incoming
broadcast stream and sending them off to
the time so that's why we call it
reflective is incoming broadcast like a
live broadcast and this module here is
going to be the one that's going to be
sending those packets out to the clients
we have a relay module which is similar
to the reflector module except that it
has a built-in broadcaster as well what
it does is it goes in it grabs a a
broadcast stream that's coming in and
then it's forwarded on to another server
it could actually be a multicast address
so in which case you could just go ahead
and forward it on to the multicast IP
address but the idea here is that it's
pushing a broadcast someplace instead of
waiting for recline to come in and
the broadcast which was the reflective
module the mp3 streaming module is
another broadcast support module what
this does is it grabs an incoming mp3
stream kind of like an ice caps or
she'll cast type of extreme that might
be sent to a server and it's going to
provide a response to any mp3 IC request
for a potluck live at p3 broadcast so
each of these is going to handle a
request in a very particular way it's
going to take it it's going to intercept
the request decide if it belongs to
itself and it's going to respond to the
client and then handle the data now we
have some service support modules built
into the server some of these you know
if you're thinking about changing the
server what start here if it has to do
with access logs or maybe pulling out
some statistics out of the server these
these modules are built into servers
they're great pieces of sample code for
you there is the error log module which
obviously is just going to go ahead and
record errors into a file but we also
have the access log which has each bar
each access to the file logged into the
to the access logs and maybe there's
something in there that you just need in
addition to with already act already
written out you know there's their
average bit rate or there's the time
connected but maybe there's something
else that you want throw an Indian maybe
the codec that was used well take a look
at the access log maybe what you need to
do is just change that or you could go
ahead and rewrite your own log of course
but this is built into the service there
in the source for you to take a look at
there is also some other modules like
the web staff module it's a HTTP module
that will return HTML web page and it
will pull out some information from the
server and generates the web page so
it's not restrict a module isn't
restricted to streaming protocol
you can implement it's there the server
it's going to call your module you can
decide whether or not you want to handle
RTSP requests or you can decide you want
to handle something else like an HTTP
request we have a web debug module and
an admin module the admin module is an
interesting one because what it does is
it takes an HTTP style request and uses
and looks for something called our admin
protocol this is a URL based protocol
that references any of the data that's
in the server so this is how our UI is
is implemented basically you can go
ahead and grab anything out of the
server using the admin protocol
implemented in the admin module and set
it as well and you can do this remotely
as if you want to finally we have the
POSIX file system module this one
doesn't deal with requests that doesn't
deal with logging what it is if the low
level implement support for reading and
file so each of the modules that are in
the server called through the API to
read a file and it all gets funneled
through the politics file system module
and this could be replaced so that if
you needed to do something like a
network file system you can go ahead and
change the implementation to do some
other kinds of pollicis call system
calls maybe you're pulling the data out
of the database instead of coming right
off the local the disk so once again
more modules that are built into the
server more functionality that is
available to you finally have the access
control modules these start out with the
access module which handles
authentication authorization we have a
patchy style users and groups files
basically it's going to go and check
that file to see if a user has access to
any of the movies on the server there's
a home directory module this one takes a
look at the URL and says oh do I have a
Tildy John in the beginning of the path
and it says okay this means that this
movie is coming out of the user's home
directory
movies directly folder not the main
server movie folder so what it does is
it allows users who have access only to
their account their movie folders in
their home directory and not to the main
server to put up full movies onto the
server and then everybody can reference
them but it can only administered what
they own there is an HD pop HTTP file
module kind of interesting it's a
dynamic module we usually have it turned
off what it does is allows you to
download a file so it's not it it could
be an example would be like in a
progressive download it also has the
ability to on the fly create a wreck
movie out of a folder of movie so it
actually pulls up takes the request it
says oh through the directory and then
it looks inside that directory and says
oh I got three files here creates a
breast movie you know with the bit rate
for each of those files and sends that
back to the QuickTime fly so it just
completely skipped over the requirement
of having to author one of these
refugees for the movies on the server
however it is an optional module of
someone once built in we call it these
types of modules dynamic modules and
mostly because we don't feel that they
are necessarily the type of feature
everybody wants running inside their
server however they are there if you
want to use them the spam defense module
is another one of these optional modules
that comes with the source basically it
can limit the number of requests coming
out of a single IP address so he threw
hundreds of play requests coming out of
a single client it's just spanning your
machine the spam defense module can put
a clamp on that and say look groaning
and allow 10 movies being played from
the single IP address
so these are access control types of
modules that there's the data ones the
content modules is the basic support and
then access control so I'm going to go
over it and switch back to our demo
system and one of the nice things about
having the source code is that if
there's a behavior in the server that
you want to change then the code is
there waiting for you and all you have
to do is find the right place to throw
your code in and you can basically
change the behavior of service so what I
did is I said I wanted a file module but
every time I gave it a URL like next I
wanted it to give me a different movie
like this one or that one or this one so
so downloading the source and going in
there and say okay every before I pass
the filename off to the the open file
command I want to be able to replace it
okay couple lines of code swap that in
there and now I've got a new behavior in
my server now you might want to create
this as a module or you might if you
have complete control of the servery
then go ahead change it it's it's all
right there add your behavior now
another module that I had mentioned in
our talk earlier was that the web stats
module and that's a dynamic module we
can see some of these modules installed
on the system these are dynamic modules
here basically what that means is every
time you throw them into this module
folder and monstrous server they're
going to be executing when the server
run these are other modules that can be
thrown in there and
run and once again these are all part of
the Darwin streaming server source and
are available to you to look at modify
use a change so getting back to that web
stats module that fits in the server
what we can do with that is go ahead and
call it let's see
hmm
what's my server comes back so I see
what we're doing here is we're waiting
for the system to come back from doing
some sort of network I oh ok now i have
a server back again so what I have
inside of on the screen here is an admin
module request into the server to find
out a preference and this module
preference is web stats and I'm going to
take a look at what it's going to show
me
ok so this module just grabs the
requests coming into the server and says
hey its web Seth I'm going to handle it
and what it's going to do is it's going
to respond but instead of a since this
was an HTTP GET coming into the server
what this module decided to do is just
going to generate an HTML web page and
send back some information about the
server now what may be what it could
have been doing is copying a log file on
demand over to some other machine thats
collecting all these statistics or doing
something like that this module here or
maybe this command was coming in from
another you are somebody has integrated
the quicktime streaming server
administration into their user interface
for controlling multiple servers or
something like that and this module
perhaps is supporting that so once again
there's various ways in which you can
access and control the server and this
is one of them just toss a module in
there and away you go you have a new
feature inside a QuickTime streaming
server so we can switch back to slides
ok so the server is a thin piece of code
but there is actually when in terms of
when it's executing but there is a lot
already built into it stuff that maybe
you don't want to have to rewrite and if
you have the opportunity you want to be
able to use so I mean so we are going to
be supporting rtsp over TCP for you RTP
over UDP Apple skip protection is built
into the server that's RTP over reliable
UDP what that mean is what that means is
there's UDP packets going out with acts
coming back and the server has ability
to do retransmit using this protocol
there's RTP and RTP tunneled in HTTP
which is basically how do you get around
far wall there's arch p of rtsp which is
our to be on top of TCP so these are all
standard protocols streaming protocols
and they're built into surveyed
automatically will handle these
connections now one of the protocols
that it doesn't automatically do for you
as HTTP basically there's a request
coming in but it itself is not going to
do anything with it if you have to have
a module that wants to basically you
would grab that request and decide based
on the URL whether it was meant for you
and not and do something with it so some
one example is the couch ESS admin
module that's going to look for a tip
URL path and it's going to decide yes
this is a path it belongs inside of the
server and I'm going to go ahead and
respond to it the empty free streaming
module is another type of HTTP support
module it looks for I see a protocol
request that coming into the streaming
server let's fast module we just looked
at that and so on and so forth there's
the other types of modules here the ref
movie module is going to take a HTTP GET
on a file a movie file
and generate a rtsp request send that
back to and the response to the get and
that tells the QuickTime 50 what I
really should be doing here is not a
dad's with an rtsp is on the file and it
turns around and makes the Archaea
spiritless looks like their website
twice and a web debug module so that's
very similar to the web stats except
that gives debugging information when
the servers compiled with debug enabled
the debug module is going to show up
with an HTML webpage for the programmer
to see real time what the memory
allocation in the server is maybe how
many file descriptors are open things
like that there are of course other ways
of getting that type of information but
this is one way in which a handy way in
which is can be done ok so the server
has these roll calls is calling to each
of the modules in the roll calls look
like you me here's a request here's a a
route roll which is sort of a pre
request call and along with each request
is going to be something to call to keep
ESS object and these are inside of the
server basically a dictionary that goes
with each of the classes that the server
support so there's the Qt SS server
class and it has an implementation
called the TTS of server interface
that's the dictionary that's going to
support the API we have rtsp sessions
that get generated whenever a client
connects there's an rtsp session
interface that goes with that class it's
an rtsp session interface CPP file and
basically what that is is the dictionary
implementation for the API to access the
data that's in the rtsp session object
same is true with RTP session another
type of protocol management classics in
the server and eat for every request the
there's a
request object that shows up in part of
our API that has an interface file
associated with it's a dictionary that
that gives access to the data so here's
the object hierarchy that's built into
the server you have your main server and
once again the server object has it has
a GPS interface file associated with it
it contains modules server preferences
and client session so when we look at
server object will be able to pull out
the clients message we can pull out
service preferences that are currently
active we can grab each of the modules
of the server is running and then within
the modules there's preferences for each
module that is own instantiating inside
of the service so what that means is
when you create a module you can say hey
I want to have my modules preferences
added to the servers XML preference file
and there's an API calls you allow you
to do that all of our modules that come
in source code do this so that means
that the preference is for your module
or immediately configurable or editable
by the admin protocol meaning a user
interface can go in there and remotely
configure your preferences without you
ever having to write anything to support
remote admin of your module the client
sessions of course you might want to
find out some information about the
stream it in real time know what's the
current bitrate of the stream or the
session all the streams that come that
are currently playing for a given client
and so the dictionaries give us this
ability to walk this tree a data
real-time pull it out of the server and
if you want to log it or use it to maybe
limit the number of users you know it's
you're finding that the current
bandwidth is just getting too high in
real time you want to start limiting
some the server in some way by number of
users of my back
let me go ahead and change the data that
configures the server real time by
accessing our data hierarchy so I want
to use the admin module that we've been
talking about just to show you what some
of these objects look like and basically
the admin module takes an H this admin
protocol which is a you or else I'll
request and maps that to the hierarchy
that's inside the server and pulls out
the information and can actually set it
to so if I wanted to grab the server
object and I want all the fields within
the server object I'm going too far off
a request to the admin module and here
it is so now it's giving me back
everything that it knows about one of
the things it has the inside server
object it is the list of modules so if
it's a dictionary up here at the top I
can see my path through the dictionary
he called the server module objects and
here are my module if I had were to draw
a stop the server drop a new dynamic
module into my modules folder and
relaunch the servery would show up in
this list now each of these modules has
its own preference and C collection pull
that out it has many different layers
but each module you can see is has all
of its settings and can be configured
here remotely so none of the modules
really have to worry about okay how am I
going to configure this thing it's
easily configurable once it's loaded up
into the server and since this
information is written back out to the
server's XML file it can be edited even
when the server isn't running can change
the xml file to modify the preferences
so
let's take a look at some stream ok this
one and I want to see the sessions that
are currently running I have one client
service session I want to drill down
into that session ok so I have some
session information right now I have a
URL looks like i have a an average
bitrate a movie file size I want to take
a look at the streams like there are two
streams I want to see if i can find the
Codex looks like i have a impact for
codec and looks like an impact for video
displaying so for every single stream
that's currently playing on the server I
can grab real-time information and pull
it up now I'm doing it through a module
you if you had a theorem LT gather that
data but if you have a module that's
currently running in its its job is to
be monitoring you know how many people
are watching this particular movie right
now and maybe I need to we start
redirecting find someplace else or maybe
I just need to start denying client you
can imagine a module doing this ok so
we're going to
which back to our slides and talk about
the source itself okay so when you on
tar the source code you're going to see
a whole bunch of files show up in some
in a streaming server directory inside
of that main top level folder are these
source directories the server t podge
directory which is the core server file
you know the GPSS service apt that's
going to load up your modules there's a
main dot cpp that's going to handle all
the command line options that you might
be running now it also has you're going
to see the rtsp session files inside the
server dotty proj directory so if you're
looking for something that's going on in
the core server the protocols the module
loading this is a place to go common
utilities is it's just a set of classes
that all of the modules and the server
uses it's our convenience classes there
is a string class as a parser class that
we use there's also our thread class or
socket class basically all the basic
stuff that you need to either manipulate
a request or just run the server is it
started calming utility cutie file lives
is the directory that if you are
interested in finding out how we parse
an impact for movie will be it this will
be of interest to you because inside of
beauty file ID is all of our epic for
parsing code all of our quicktime movie
code it basically handles any hinted
mpeg-4 or quicktime streaming movie the
api common code all of the modules use
use it it's basically they're four sets
of API calls they kind of seem to go
together
and you know I want to create a new
preference and set its value and this is
where usually we throw those types of
commonly used code together so you might
want to go ahead and see if there's any
of that code in there for your module
that you want to use or emulate the API
modules themselves implementation for
all the modules I've shown you is in
this directory you can just walk through
there now do a grep browse it and pull
up the force for any of the modules rtsp
client live is it's just a library but
basically when you instantiate it it's
going to give you the ability to connect
to a streaming server as an artistic
lion i'll go ahead and do it this time
you can tell us we do a described i'll
get back to the SBP response you can ask
it to start playing and it will pull
down a rtsp stream it'll do it over any
of the protocols that the service
support so this is how we test out our
server using this library you know if
you tell it connect to the instantiation
for the rtsp client live to connect and
download over tcp i'll do that or in
HTTP using reliable UDP perhaps our
script protection that's the rtsp flight
line the server actually uses it in a
couple places one of them is in the
relay module the other is in our file
broadcasters particular the playlist
broadcaster has a built in client and it
uses artistic lima and one last piece
the streaming load tool is a little
piece of binary code that goes out and
does load testing and we use the rtsp
client lives in that tool so rtcp
utilities if you're interested in RTP
protocol for some reason maybe there's a
bug in the servers enough but the code
is there for you to take a look at six
or change if you need to same thing is
true with HTTP
and that's the top level of the forestry
as you end hard and when you go ahead
and build our code you're going to end
up with more than just the streaming
server you have the playlist broadcaster
which is like the name side of the plate
it takes a playlist of movie files and
concatenate them together and streams
the tooth into the server and these can
then be turned around by the server and
to support each client it may be
requesting that the live stream actually
it's a pseudo live stream of course
players broadcaster will loop the list
of movies if that's what you asked you
to so how's this continually running
playback of some keynote speech or
something like that also there's an mp3
broadcaster which is the same same idea
except it's doing a for mp3 instead of
impact lawyers and QuickTime movies we
have a straining proxy and that source
code is there there's QT file tools
those are for those people are once
again her interested in the in the
mpeg-4 movie file format and I want to
see how it goes out and extracts the
packets out of the file these tools
basically our command line tools you can
go ahead and rip out streams of packets
from from any given hinted file the web
admin is our user interface that we
provide with the Dharma streaming server
so let's say you want to personalize or
privatize the web admin so it doesn't
say apple quicktime streaming server all
over it you want to throw in your own UI
to the HTML going this web admin is in
the source you can go ahead and change
it it's the as well as the Qt pass as
well i'm going to doesn't really do much
if you want to add users and groups
you've run the key key password file if
you don't like the format for some
reason go ahead and change it if you
want to use our code fine so
or you can replace to the course so one
of the things that you might want to do
is just change the name if you're
deploying it with your product here now
quicktime charged Dharma streaming
server doesn't really work for you you
want to call it my demo server or your
server and so you can go ahead and
change those constants that are
available in the server there's a few
places you have to go and look for
things it so it was 10 you want to look
in the project builder file there's a if
you're dealing with the web admin and
you're going to be looking in the pearl
file that takes part of the web admin it
was basically the Installer scripts you
can find it pretty much by doing a fine
text and file its and so then you can
package it up in and distribute it with
you know maybe you're a hardware server
product or something like that that
shifts with the darn streaming server
once again building the software we have
a builded script this is what you would
run at the command line to build our
POSIX version of the server you would
just find the script and run it there's
it's also works for OS 10 you don't want
to use the project builder project you
can just execute from the command line
rebuild the binary and tested it show up
inside of a bill directly on those 10 on
Windows NT it's a little bit different
we have a Windows NT support directory
so those of you who are building your
software for windows are going to go
down in there find your visual c++
project or worksheet load that up you
want to be able you want to do a batch
build and it's going to generate a debug
and release directory and throw all the
binaries in there
so once you have your software built you
want to be able to create an installer
now once at this point it kind of gets
goes into how do you want to do it the
pre-built binary says Apple has on our
site for you to download we're all
created using this build tarball script
which you know goes ahead builds it
generates a direct and install directory
tars it up and then you go ahead and
download it on Targ lens they install
scripts and it goes ahead and throws it
on to your machine and that would be for
the POSIX platforms on ls10 we have a
script that's going to build an LS can
installer package for you so it's going
to go off in front do all the pieces and
throw it into this installer package the
important piece about the bill dose can
installer package that there is some
logic when it's installing as to what
how to upgrade existing installation or
what to do about setting it up with the
proper users and groups that the server
might need on ls10 for example and
version 5 we're going to be running as
user QT SS and installer package will
make sure that that user is on the
machine so that when the server runs it
can go ahead and strength when those
windows NT we just use them exist
package that the bat file goes ahead and
organizes the files for you you might
want to edit or change that yourself
so we're going to move on to
troubleshooting so after you've gone
through you've created your module
you've edited things you've built it
you've been created installer if you
find that you need to troubleshoot the
server there's some commonly used
debugging preferences that we have and
the first three that i have here had to
do with protocol and the first one is
rtsp debug.print so I just want to see
when a request comes in what is the
server looking at what's it what's it
think it's trying to casa now you could
go ahead and take your network sniffer
and put that on there each time but
sometimes it's easier just to go ahead
and turn on this precious run it to
serve in the terminal and just watch
what's happening now just following that
is the packet header furnace which
applies to our RTP and rtcp so the
actual data packets themselves you don't
want to it will just like the rtsp
pronounced will show you the rtsp the
packet header printf are there to show
you the media packets that are being
sent by the server so that means that if
there is an RTP packet a receiver report
send a report an application packet or a
knack and the acts are for the Skip
protection then you'll see them as they
come into the server or get sent out and
if you are if you do have these on you
want to be able to see them you're going
to need to run the server in debug mode
which means at the command line at a
dash D okay so I'm going to just turn on
the debugging printf here just to show
you what they look like I'm going to go
ahead and add the preference with my
admin protocol using the admin module
and so the URL was set this value rtsp
debug.print asked to true
so at this point what we should have is
a streaming server that has our debug
printf in it whatever it wakes up
hmm try different new 10 up okay okay so
we don't need this anymore ok so the
rtsp debug.print em we have an rtsp
request here described and some more
information and a file module that
accepted it and sent back something
called the SBP right here to the client
and this is just handy information that
as you're debugging your module you
might need to take a look at these
requests so another type of plus i'm
going to try is what happens if i throw
an HTTP GET at the server and i'm going
to call it an mp4 okay looks like what
happened is it started playing in fact
started playing and it looks like it's
streaming but i just did initially be
get so we can take a look at what what
all this thing is doing by looking at
rtsp debug printers it looks like a get
went to the server and a module there
picked it up and return the HTTP GET
with an rtsp URL which went to the
client and told it oh I guess that means
that what I should be doing is a RTS be
described with this URL so that this
could be a redirect actually it's not an
rtsp redirect what is an HTTP GET that
contains a redirect in the response now
you can imagine this module that happens
to be available inside the source code
it's called the refs moving module being
used in lots of different ways to
generate different redirects or
types of responses to the client so that
you can go ahead and have an rtsp to
some other movie or some other server
even so that was how we take a look at
what's going on in the server when we're
debugging the using the rtsp debug
printf and let's go back to the slides
and in the slides we'll take a look at a
couple more p bug printf basically you
can turn these on when you compile the
service one of the useful ones if you
have a module that's doing something
kind of tricky it's having a lot of
different roll calls maybe it has its
own thread you might want to take a look
at one is actually getting executed and
the way to do that it's fine in our
comedy tildy's the base class for a task
which is basic of entity that's getting
executed in the server and if you would
turn on the debugging there you'll find
all these printouts that show up let's
say oh the server is working on our kiss
p session right now and there's an
access log called right now that's being
executed so you can find out exactly
when all the modules and what their
interactions are by turning on this p
bug printf in the file source there is
also another handy little flag you can
turn this on and you can pretty much see
what the breeze coming what kind of
reading is a server doing how often is
it hitting the disk is it you know
they're reading all over the place or is
it you know seem to be reading
sequentially how's the caching working
in the server and this is the file
source debug there might be some some
reason where you are transferring the
reads off to maybe a database or
something like that so the file system
and you want to see how how the reads
are being handled and server so another
debug option for you
so as I was talking about the server and
its protocols I mentioned rtsp RTP SVP
session description protocol and all of
these that have RFC is available on the
Internet so if you want to take a look
at the protocol and find out more about
what's what clients might be doing with
the server what the server should be
doing or what you can do to change the
way the behavior of the servers you can
take a look at these RFC's up on the web
there's some other open source projects
that handle rtsp and RTP one of them is
the mpeg-4 RT on sourceforge so they
have an open source slide that actually
will play the audio and video and it
will work with our artists are streaming
service it's an open source client and
in fact they even have an encoder I
believe well as well so there are
related streaming sources of our
resources that you can find out there on
the internet live media is yet another
one these are open source and we
interoperate because we have our
standard space so as you can see that
there's RFC's the when it comes to codex
mpeg-4 is the standard that you believe
strongly in and our server supports so
the
programming for our clip time streaming
server is essentially just a matter
going in there and getting the source
code looking at the modules finding out
what we already are doing thinking about
what we want you want the server to be
doing and go ahead change the code add
your module add your functionality and
now you have a new server and we hope
that we can add more functionality to
sort of server for you as well but we
have where we're making Fargo each year
there's new features into the server and
and you'll be able to find out more in
the next year so this is the follow-up
to my talk and I'd like to bring up
Guillermo Ortiz to tell you something
about the other sessions that are
available here at the show and Guillermo
thank you much so go away okay so just
as a side note you can see the big
yellow ball there they quicktime
feedback forum has changed venues so we
will be moving to the marina as soon as
we finish with this conversation here
since most of these presentations
already happened i was going to remind
you that as these to the conference you
will be getting access to the stream
versions of the presentations in next
few weeks so if you missed any of these
you or you want to go back to see what
was mentioned something that you means
this will be the opportunity to it and
you will also be receiving a package of
dvds that contain all the stations of
the conference so this is coming to you
in a few weeks more than the download
streaming movies which will be quite a
portion for this code for decision so if
you have any other question or if you
need something for me
showing a quick time man a double tom is
the address that you want to write any
questions and we'll try to route them to
the right people documentation apple
quicktime is the main page for any
information on quicktime developers
about that common documentation is for
general information documentation a
quick time I don't think that we have
anything special for this session but
again adding these to the conference
there is a number of downloads that I
available only to you right now so you
have to go to the connected apple com
log in as a member of ABC and you'll get
the download under the WWDC 2003 many
more information the streaming server
mailing list if you want to have a
conversation with all your colleagues
all over the world who are using the
technology and more information work to
get for the swimming server modules we
are getting to the ending of the
conference but you still have a day to
go to the QuickTime lab downstairs is in
the Sacramento room and have engineering
there to answer your questions or
QuickTime programming
you