[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11965: Improvements to rtmpget (the
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11965: Improvements to rtmpget (these are relevant to the core implementation, not |
Date: |
Wed, 24 Feb 2010 16:35:10 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 11965 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2010-02-24 16:35:10 +0100
message:
Improvements to rtmpget (these are relevant to the core implementation, not
to RTMP). Don't invoke _checkbw because some servers don't like it. Read
the stream ID correctly. videolectures.net now also responds, but
unfortunately
uses AS3.
modified:
libbase/RTMP.cpp
utilities/rtmpget.cpp
=== modified file 'libbase/RTMP.cpp'
--- a/libbase/RTMP.cpp 2010-02-24 11:22:12 +0000
+++ b/libbase/RTMP.cpp 2010-02-24 15:05:18 +0000
@@ -173,7 +173,7 @@
close();
return false;
}
-
+
return true;
}
@@ -831,7 +831,7 @@
//
/// Why would we want to send this?
bool
-sendServerBW(RTMP* r)
+sendServerBW(RTMP& r)
{
RTMPPacket packet(4);
@@ -840,8 +840,8 @@
SimpleBuffer& buf = *packet.buffer;
- buf.appendNetworkLong(r->serverBandwidth());
- return r->sendPacket(packet);
+ buf.appendNetworkLong(r.serverBandwidth());
+ return r.sendPacket(packet);
}
=== modified file 'utilities/rtmpget.cpp'
--- a/utilities/rtmpget.cpp 2010-02-24 13:34:09 +0000
+++ b/utilities/rtmpget.cpp 2010-02-24 15:28:11 +0000
@@ -474,8 +474,13 @@
/// 1. connect.
sendConnectPacket(r, nc, app, ver, swf, tc, page);
- /// Check bandwidth.
- sendCheckBW(r, nc);
+ // Some servers are fine if we send _onbwcheck here, others aren't.
+ // Either way it's a SWF implementation detail, not an automatic
+ // send.
+ //sendCheckBW(r, nc);
+
+ // Note that rtmpdump sends the "ServerBW" control ping when the connect
+ // call returns.
log_debug("Connect packet sent.");
@@ -490,7 +495,7 @@
b = r.getMessage();
}
- /// Retrive video packets.
+ /// Retrieve video packets.
boost::shared_ptr<SimpleBuffer> f = r.getFLVFrame();
while (f.get()) {
if (flv) {
@@ -531,7 +536,6 @@
bool ret = false;
-
/// _result means it's the answer to a remote method call initiated
/// by us.
if (method == "_result") {
@@ -553,11 +557,16 @@
log_debug("createStream invoked");
if (*payload != AMF::NULL_AMF0) return false;
++payload;
-
- r.m_stream_id = AMF::readNumber(payload, end);
-
- log_debug("Stream ID: %s", r.m_stream_id);
- r.m_stream_id = 1;
+
+ log_debug("AMF buffer for createStream: %s\n",
+ hexify(payload, end - payload, false));
+
+ if (*payload != AMF::NUMBER_AMF0) return false;
+ ++payload;
+ double sid = AMF::readNumber(payload, end);
+
+ log_debug("Stream ID: %s", sid);
+ r.m_stream_id = sid;
/// Issue NetStream.play command.
sendPlayPacket(r, nc);
@@ -602,7 +611,6 @@
// It contains information, but we don't have to do anything.
if (method == "onBWDone") {
// This is a SWF implementation detail, not required by the protocol.
- //sendCheckBW(r, nc);
return ret;
}
@@ -670,7 +678,12 @@
//log_debug("read string %s", n);
if (payload == end) break;
- if (*payload != AMF::STRING_AMF0) return false;
+ // There's no guarantee that all members are strings, but
+ // it's usually enough for this.
+ if (*payload != AMF::STRING_AMF0) {
+ break;
+ }
+
++payload;
if (payload == end) break;
@@ -687,7 +700,7 @@
if (code.empty() || level.empty()) return false;
- //log_debug( "%s, onStatus: %s", __FUNCTION__, code);
+ log_debug("onStatus: %s, %s", code, level);
if (code == "NetStream.Failed"
|| code == "NetStream.Play.Failed"
|| code == "NetStream.Play.StreamNotFound"
@@ -696,17 +709,19 @@
r.m_stream_id = -1;
r.close();
log_error( "Closing connection: %s", code);
+ std::exit(EXIT_SUCCESS);
}
if (code == "NetStream.Play.Start") {
log_debug("Netstream.Play.Start called");
+ return ret;
}
// Return 1 if this is a Play.Complete or Play.Stop
if (code == "NetStream.Play.Complete" ||
code == "NetStream.Play.Stop") {
r.close();
- ret = true;
+ std::exit(EXIT_SUCCESS);
}
}
return ret;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11965: Improvements to rtmpget (these are relevant to the core implementation, not,
Benjamin Wolsey <=