[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1792-gf246e38 |
Date: |
Sat, 14 Sep 2013 08:14:00 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via f246e38aa4723afe397b23f52b489391a17419b5 (commit)
from e0fd4a43947380f57894e579a5d4841239959b93 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=f246e38aa4723afe397b23f52b489391a17419b5
commit f246e38aa4723afe397b23f52b489391a17419b5
Author: George Thomas <address@hidden>
Date: Wed Sep 4 15:43:15 2013 +0200
Add support for RTMP streaming (patch #8086)
Also fixes bug #39949
Signed-off-by: Sandro Santilli <address@hidden>
diff --git a/libcore/asobj/NetConnection_as.cpp
b/libcore/asobj/NetConnection_as.cpp
index 3d56a69..2c9a160 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -283,18 +283,33 @@ public:
virtual void call(as_object* asCallback, const std::string& methodName,
const std::vector<as_value>& args)
{
- SimpleBuffer buf;
- amf::Writer aw(buf);
- aw.writeString(methodName);
- const size_t id = asCallback ? callNo() : 0;
- aw.writeNumber(id);
-
- for (size_t i = 0; i < args.size(); ++i) {
- args[i].writeAMF0(aw);
+
+ if(methodName == "play") {
+ SimpleBuffer buf;
+ amf::Writer aw(buf);
+ aw.writeString("play");
+ aw.writeNumber(0);
+ aw.writeNull();
+ for (size_t i = 0; i < args.size(); ++i) {
+ args[i].writeAMF0(aw);
+ }
+ // TODO Use the play method and the streamId from createStream
+ _rtmp.call(buf);
}
- _rtmp.call(buf);
- if (asCallback) {
- pushCallback(id, asCallback);
+ else {
+ SimpleBuffer buf;
+ amf::Writer aw(buf);
+ aw.writeString(methodName);
+ const size_t id = asCallback ? callNo() : 0;
+ aw.writeNumber(id);
+
+ for (size_t i = 0; i < args.size(); ++i) {
+ args[i].writeAMF0(aw);
+ }
+ _rtmp.call(buf);
+ if (asCallback) {
+ pushCallback(id, asCallback);
+ }
}
}
@@ -476,6 +491,20 @@ NetConnection_as::connect()
}
+bool
+NetConnection_as::isRTMP () {
+
+ const RunResources& r = getRunResources(owner());
+ URL url(_uri, r.streamProvider().baseURL());
+ if (url.protocol() == "rtmp") {
+
+ return true;
+ } else {
+
+ return false;
+ }
+}
+
bool
NetConnection_as::connect(const std::string& uri)
{
@@ -576,23 +605,59 @@ NetConnection_as::call(as_object* asCallback, const
std::string& methodName,
startAdvanceTimer();
}
+void
+NetConnection_as::createStream(as_object* asCallback) {
+
+ if (! this -> isRTMP()) {
+ return;
+ }
+
+ if (!_currentConnection.get()) {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("NetConnection.call: can't call while not
connected"));
+ );
+ return;
+ }
+
+ std::string methodName = "createStream";
+ _currentConnection -> call(asCallback, methodName,
+ std::vector<as_value>());
+
+ startAdvanceTimer();
+}
+
std::auto_ptr<IOChannel>
NetConnection_as::getStream(const std::string& name)
{
const RunResources& ri = getRunResources(owner());
const StreamProvider& streamProvider = ri.streamProvider();
-
- // Construct URL with base URL (assuming not connected to RTMP server..)
- // TODO: For RTMP return the named stream from an existing RTMP connection.
- // If name is a full or relative URL passed from NetStream.play(), it
- // must be constructed against the base URL, not the NetConnection uri,
- // which should always be null in this case.
+
const RcInitFile& rcfile = RcInitFile::getDefaultInstance();
-
- URL url(name, streamProvider.baseURL());
-
- return streamProvider.getStream(url, rcfile.saveStreamingMedia());
+
+ if(isRTMP())
+ {
+ // Handling RTMP connections separately. Correcting the url
+ // TODO: For RTMP return the named stream from an existing RTMP
connection.
+ as_object *obj = &owner(); // Use the callBack of the object to get
the streamId
+ createStream(obj);//Create Stream called
+ // USe streamId in the call of play
+ std::vector<as_value> args;
+ args.push_back(name); // TODO Add args[1] to be the return from
createStream
+ _currentConnection->call(obj, "play", args);
+ std::string rtmpUrl = _uri + "/" + name;
+ URL url(rtmpUrl, streamProvider.baseURL());
+ return streamProvider.getStream(url, rcfile.saveStreamingMedia());
+ }
+ else
+ {
+ // Construct URL with base URL (assuming not connected to RTMP
server..)
+ // If name is a full or relative URL passed from NetStream.play(), it
+ // must be constructed against the base URL, not the NetConnection uri,
+ // which should always be null in this case.
+ URL url(name, streamProvider.baseURL());
+ return streamProvider.getStream(url, rcfile.saveStreamingMedia());
+ }
}
@@ -1216,7 +1281,7 @@ HTTPConnection::call(as_object* asCallback, const
std::string& methodName,
pushCallback(callID, asCallback);
}
}
-
+
void
RTMPConnection::handleInvoke(const boost::uint8_t* payload,
const boost::uint8_t* end)
diff --git a/libcore/asobj/NetConnection_as.h b/libcore/asobj/NetConnection_as.h
index e0baadc..f053b7e 100644
--- a/libcore/asobj/NetConnection_as.h
+++ b/libcore/asobj/NetConnection_as.h
@@ -111,6 +111,10 @@ public:
private:
+ bool isRTMP();
+
+ void createStream(as_object* asCallback);
+
/// Extend the URL to be used for playing
void addToURL(const std::string& url);
diff --git a/testsuite/misc-ming.all/Makefile.am
b/testsuite/misc-ming.all/Makefile.am
index 05e8d81..e9db815 100644
--- a/testsuite/misc-ming.all/Makefile.am
+++ b/testsuite/misc-ming.all/Makefile.am
@@ -57,6 +57,7 @@ EXTRA_DIST = \
gotoFrame2Test.as \
intervalTest.as \
red5test.as \
+ oflaDemo.as \
remoting.as \
rtmpytest.as \
widgets.as \
@@ -269,6 +270,7 @@ check_SCRIPTS += remotingTestRunner
endif
if ENABLE_RED5_TESTING
check_SCRIPTS += red5test-runner
+check_SCRIPTS += oflaDemo-runner
endif
if ENABLE_RTMPY_TESTING
check_SCRIPTS += rtmpytest-runner
@@ -1342,6 +1344,15 @@ red5test.swf: red5test.as Dejagnu.swf Makefile
../actionscript.all/check.as ../a
-DUSE_DEJAGNU_MODULE -DOUTPUT_VERSION=7 Dejagnu.swf
$(srcdir)/red5test.as \
$(srcdir)/../actionscript.all/dejagnu_so_fini.as
+oflaDemo.swf: oflaDemo.as Dejagnu.swf Makefile ../actionscript.all/check.as
../actionscript.all/utils.as
+ $(MAKESWF) $(MAKESWF_FLAGS) -n network -r12 -o $@ -v7
-DRED5_HOST='\"$(RED5_HOST)\"' \
+ -DUSE_DEJAGNU_MODULE -DOUTPUT_VERSION=7 Dejagnu.swf
$(srcdir)/oflaDemo.as \
+ $(srcdir)/../actionscript.all/dejagnu_so_fini.as
+
+oflaDemo-runner: $(srcdir)/../generic-testrunner.sh oflaDemo.swf
+ sh $(srcdir)/../generic-testrunner.sh -c "ENDOFTEST" $(top_builddir)
oflaDemo.swf > $@
+ chmod 755 $@
+
red5test-runner: $(srcdir)/../generic-testrunner.sh red5test.swf
sh $(srcdir)/../generic-testrunner.sh -c "ENDOFTEST" $(top_builddir)
red5test.swf > $@
chmod 755 $@
@@ -1596,7 +1607,8 @@ if ENABLE_HTTP_TESTSUITE
TEST_CASES += remotingTestRunner
endif
if ENABLE_RED5_TESTING
-TEST_CASES += red5test-runner
+TEST_CASES += red5test-runner
+TEST_CASES += oflaDemo-runner
endif
if ENABLE_RTMPY_TESTING
TEST_CASES += rtmpytest-runner
diff --git a/testsuite/misc-ming.all/oflaDemo.as
b/testsuite/misc-ming.all/oflaDemo.as
new file mode 100644
index 0000000..7686f52
--- /dev/null
+++ b/testsuite/misc-ming.all/oflaDemo.as
@@ -0,0 +1,100 @@
+// This test relies on a default deploy of red5 on localhost
+//
+// Build with:
+// makeswf -n network -o red5test.swf ../Dejagnu.swf red5test.as
../actionscript.all/dejagnu_so_fini.as
+// Run with:
+// firefox red5test.swf
+// Or:
+// gnash red5test.swf
+//
+//
+
+note("SWF" + OUTPUT_VERSION + " - " + System.capabilities.version + "\n");
+rcsid="red5test.as - <bzr revno here>";
+
+#define info _root.note
+#define note _root.note
+#define fail_check _root.fail
+#define pass_check _root.pass
+#define xfail_check _root.xfail
+#define xpass_check _root.xpass
+
+#include "../actionscript.all/check.as"
+#include "../actionscript.all/utils.as"
+
+stop();
+
+endOfTest = function()
+{
+ totals(17);
+ trace("ENDOFTEST");
+ play();
+};
+
+// -P FlashVars='hostname=localhost,rtmptport5080=rtmpport=1935'
+hostname = RED5_HOST;
+funcId = -1;
+
+if (rtmpport == undefined) {
+ rtmpport = 1935;
+ note("No RTMP port specified, defaulting to "+rtmpport);
+}
+
+function checkAfter (netStream) {
+ note("Time :" + netStream.time);
+ check(netStream.bufferLength > 0);
+ check_equals(netStream.bufferTime, '3');
+ xcheck(netStream.decodedFrames > 0);
+ check(netStream.time > 0);
+ check_equals(netStream.currentFps, '0' );
+ clearInterval(funcId);
+ endOfTest();
+};
+
+test1 = function(netStream) {
+ note ("Running test1");
+ check_equals(typeof(netStream), 'object');
+
+ // Checking for properties
+ xcheck_equals(typeof(netStream.audiocodec), 'number');
+ xcheck_equals(typeof(netStream.videocodec), 'number');
+ xcheck_equals(typeof(netStream.decodedFrames), 'number');
+ check_equals(typeof(netStream.bytesTotal), 'number');
+ check_equals(typeof(netStream.bytesLoaded), 'number');
+ xcheck_equals(typeof(netStream.liveDelay), 'number');
+ check_equals(typeof(netStream.bufferLength), 'number');
+ check_equals(typeof(netStream.bufferTime), 'number');
+ check_equals(typeof(netStream.currentFps), 'number');
+ check_equals(typeof(netStream.time), 'number');
+
+ netStream.play("square");
+ netStream.setBufferTime(3);
+ netStream.onMetaData = function(object) {
+ funcId = setInterval(checkAfter, 1000, netStream);
+ };
+};
+
+
+runtests = function(ns)
+{
+ note("Running tests for NetStream.");
+ test1(ns);
+};
+
+ncrtmp = new NetConnection();
+ncrtmp.statuses = new Array();
+ncrtmp.onStatus = function()
+{
+ this.statuses.push(arguments);
+ note('NetConnection.onStatus called with args: ' + dumpObject(arguments));
+ lastStatusArgs = ncrtmp.statuses[ncrtmp.statuses.length-1];
+ if((lastStatusArgs[0].level == "status") && (lastStatusArgs[0].code ==
"NetConnection.Connect.Success")) {
+ pass("RTMP connection - status Success");
+ netStream = new NetStream(this);
+ runtests(netStream);
+ }
+};
+
+rtmpuri = "rtmp://"+hostname+":"+rtmpport+"/oflaDemo";
+note("Connecting to "+rtmpuri);
+ncrtmp.connect(rtmpuri);
-----------------------------------------------------------------------
Summary of changes:
libcore/asobj/NetConnection_as.cpp | 109 ++++++++++++++++++++++++++++-------
libcore/asobj/NetConnection_as.h | 4 +
testsuite/misc-ming.all/Makefile.am | 14 ++++-
testsuite/misc-ming.all/oflaDemo.as | 100 ++++++++++++++++++++++++++++++++
4 files changed, 204 insertions(+), 23 deletions(-)
create mode 100644 testsuite/misc-ming.all/oflaDemo.as
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1792-gf246e38,
Sandro Santilli <=