Revision: 10049
Author: oleg.kulikoff
Date: Thu Feb 18 09:28:24 2010
Log: Issue 1258: RTP stack performance improvements
Issue 1283: Restore sequence of RTP packets
Issue 1276: Jitter buffer always return one packet.
Issue 1288: Media Player
http://code.google.com/p/mobicents/source/detail?r=10049
Added:
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/mediaplayer
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/mediaplayer/MediaPlayerImpl.java
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/mediaplayer/Track.java
Modified:
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Demultiplexer.java
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Multiplexer.java
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Proxy.java
=======================================
--- /dev/null
+++
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/mediaplayer/MediaPlayerImpl.java
Thu Feb 18 09:28:24 2010
@@ -0,0 +1,87 @@
+/*
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software
Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA 02110-1301 USA
+ */
+package org.mobicents.media.server.impl.resource.mediaplayer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import javax.media.Player;
+import org.mobicents.media.MediaSource;
+import org.mobicents.media.server.impl.BaseComponent;
+import
org.mobicents.media.server.impl.resource.mediaplayer.audio.AudioPlayerImpl;
+import
org.mobicents.media.server.impl.resource.mediaplayer.video.VideoPlayerImpl;
+import org.mobicents.media.server.spi.MediaType;
+import org.mobicents.media.server.spi.MultimediaSource;
+import org.mobicents.media.server.spi.clock.Timer;
+
+/**
+ *
+ * @author kulikov
+ */
+public class MediaPlayerImpl extends BaseComponent implements
MultimediaSource {
+
+ //engines for generating media
+ private HashMap<String, MediaSource> engines = new HashMap();
+
+ //list of supported media types
+ private final static ArrayList<String> mediaTypes = new ArrayList();
+ static {
+ mediaTypes.add(MediaType.AUDIO);
+ mediaTypes.add(MediaType.VIDEO);
+ }
+
+ /**
+ * Creates new instance of MediaPlayer
+ *
+ * @param name the name of media player component
+ */
+ public MediaPlayerImpl(String name, Timer timer) {
+ super(name);
+ //create audio processing engine
+ engines.put(MediaType.AUDIO, new AudioPlayerImpl(name + ".audio",
timer));
+ engines.put(MediaType.VIDEO, new VideoPlayerImpl(name + ".audio",
timer));
+ }
+
+ /**
+ * (Non Java-doc.)
+ *
+ * @see org.mobicents.media.server.spi.MultimediaSource#getMediaTypes()
+ */
+ public Collection<String> getMediaTypes() {
+ return mediaTypes;
+ }
+
+ /**
+ * (Non Java-doc.)
+ *
+ * @see
org.mobicents.media.server.spi.MultimediaSource#getMediaSource()
+ */
+ public MediaSource getMediaSource(String media) {
+ return engines.get(media);
+ }
+
+}
=======================================
--- /dev/null
+++
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/mediaplayer/Track.java
Thu Feb 18 09:28:24 2010
@@ -0,0 +1,56 @@
+/*
+ * Mobicents, Communications Middleware
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party
+ * contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software
Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License
+ * for more details.
+ *
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ *
+ * Boston, MA 02110-1301 USA
+ */
+package org.mobicents.media.server.impl.resource.mediaplayer;
+
+import java.io.IOException;
+import org.mobicents.media.Buffer;
+import org.mobicents.media.Format;
+
+/**
+ *
+ * @author kulikov
+ */
+public interface Track {
+ /**
+ * Gets the format of this audio stream.
+ *
+ * @return the format object.
+ */
+ public Format getFormat();
+
+ /**
+ * Fills buffer with next portion of media data.
+ * @param buffer
+ */
+ public void process(Buffer buffer) throws IOException;
+
+ /**
+ * Closes this stream.
+ */
+ public void close();
+
+}
=======================================
---
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Demultiplexer.java
Wed Feb 10 07:14:05 2010
+++
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Demultiplexer.java
Thu Feb 18 09:28:24 2010
@@ -167,19 +167,6 @@
public Input(String name) {
super(name + "[input]");
}
-
- /**
- * (Non Java-doc).
- *
- * @see
org.mobicents.media.MediaSink#isAcceptable(org.mobicents.media.Format)
- */
- public boolean isAcceptable(Format fmt) {
- Collection<AbstractSource> streams = getStreams();
- for (AbstractSource stream : streams) {
- if (((Output)stream).isAcceptable(fmt)) return true;
- }
- return false;
- }
/**
* Reads supported formats from other party if connected.
@@ -247,16 +234,6 @@
@Override
public void stop() {
}
-
- /**
- * Checks is other party supports specofied format.
- *
- * @param fmt the format to check
- * @return true if other party supports this format.
- */
- public boolean isAcceptable(Format fmt) {
- return otherParty != null && otherParty.isAcceptable(fmt);
- }
/**
* Gets list of formats supported by other party.
=======================================
---
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Multiplexer.java
Wed Feb 10 07:14:05 2010
+++
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Multiplexer.java
Thu Feb 18 09:28:24 2010
@@ -165,15 +165,6 @@
inputFormats = new Format[list.size()];
list.toArray(inputFormats);
}
-
- /**
- * (Non Java-doc).
- *
- * @see
org.mobicents.media.MediaSink#isAcceptable(org.mobicents.media.Format)
- */
- public boolean isAcceptable(Format fmt) {
- return output.isAcceptable(fmt);
- }
/**
* Implement input stream.
@@ -193,15 +184,6 @@
public String getId() {
return getIdentifier();
}
-
- /**
- * (Non Java-doc).
- *
- * @see
org.mobicents.media.MediaSink#isAcceptable(org.mobicents.media.Format)
- */
- public boolean isAcceptable(Format fmt) {
- return output.isAcceptable(fmt);
- }
/**
* (Non Java-doc).
@@ -267,16 +249,6 @@
reassemblyFormats();
return inputFormats;
}
-
- /**
- * Checks is other party supports specofied format.
- *
- * @param fmt the format to check
- * @return true if other party supports this format.
- */
- public boolean isAcceptable(Format fmt) {
- return otherParty != null && otherParty.isAcceptable(fmt);
- }
/**
* Gets list of formats supported by other party.
=======================================
---
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Proxy.java
Wed Feb 10 07:14:05 2010
+++
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/impl/resource/Proxy.java
Thu Feb 18 09:28:24 2010
@@ -252,18 +252,6 @@
return otherParty.getFormats();
}
- public boolean isAcceptable(Format format) {
- if (formats != null) {
- for (Format fmt: formats) {
- if (fmt.matches(format)) {
- return true;
- }
- }
- return false;
- }
- return output.isAcceptable(format);
- }
-
public void sync(MediaSource mediaSource) {
}
@@ -345,10 +333,6 @@
}
}
- public boolean isAcceptable(Format format) {
- return otherParty != null && otherParty.isAcceptable(format);
- }
-
/**
* Gets the list of formats supported by media sink connected to
* this channel