mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix objectEncoding bug, default to AMF0, change to AMF3 if required.
This commit is contained in:
parent
99aa8bc087
commit
e598616e14
3 changed files with 23 additions and 5 deletions
|
@ -96,7 +96,7 @@ int SrsClient::do_cycle()
|
|||
}
|
||||
srs_verbose("set peer bandwidth success");
|
||||
|
||||
if ((ret = rtmp->response_connect_app()) != ERROR_SUCCESS) {
|
||||
if ((ret = rtmp->response_connect_app(req)) != ERROR_SUCCESS) {
|
||||
srs_error("response connect app failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* the signature for packets to client.
|
||||
*/
|
||||
#define RTMP_SIG_FMS_VER "3,5,3,888"
|
||||
#define RTMP_SIG_AMF0_VER 3
|
||||
#define RTMP_SIG_AMF0_VER 0
|
||||
#define RTMP_SIG_SRS_NAME "srs(simple rtmp server)"
|
||||
#define RTMP_SIG_SRS_URL "https://github.com/winlinvip/simple-rtmp-server"
|
||||
#define RTMP_SIG_SRS_VERSION "0.1"
|
||||
|
@ -53,6 +53,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define StatusCodeStreamStart "NetStream.Play.Start"
|
||||
#define StatusCodeDataStart "NetStream.Data.Start"
|
||||
|
||||
SrsRequest::SrsRequest()
|
||||
{
|
||||
objectEncoding = RTMP_SIG_AMF0_VER;
|
||||
}
|
||||
|
||||
SrsRequest::~SrsRequest()
|
||||
{
|
||||
}
|
||||
|
||||
int SrsRequest::discovery_app()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -183,6 +192,11 @@ int SrsRtmp::connect_app(SrsRequest* req)
|
|||
if ((prop = pkt->command_object->ensure_property_string("swfUrl")) != NULL) {
|
||||
req->swfUrl = srs_amf0_convert<SrsAmf0String>(prop)->value;
|
||||
}
|
||||
|
||||
if ((prop = pkt->command_object->ensure_property_string("objectEncoding")) != NULL) {
|
||||
req->objectEncoding = srs_amf0_convert<SrsAmf0Number>(prop)->value;
|
||||
}
|
||||
|
||||
srs_info("get connect app message params success.");
|
||||
|
||||
return req->discovery_app();
|
||||
|
@ -228,7 +242,7 @@ int SrsRtmp::set_peer_bandwidth(int bandwidth, int type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::response_connect_app()
|
||||
int SrsRtmp::response_connect_app(SrsRequest* req)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -242,7 +256,7 @@ int SrsRtmp::response_connect_app()
|
|||
pkt->info->properties[StatusLevel] = new SrsAmf0String(StatusLevelStatus);
|
||||
pkt->info->properties[StatusCode] = new SrsAmf0String(StatusCodeConnectSuccess);
|
||||
pkt->info->properties[StatusDescription] = new SrsAmf0String("Connection succeeded");
|
||||
pkt->info->properties["objectEncoding"] = new SrsAmf0Number(RTMP_SIG_AMF0_VER);
|
||||
pkt->info->properties["objectEncoding"] = new SrsAmf0Number(req->objectEncoding);
|
||||
SrsASrsAmf0EcmaArray* data = new SrsASrsAmf0EcmaArray();
|
||||
pkt->info->properties["data"] = data;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ struct SrsRequest
|
|||
std::string tcUrl;
|
||||
std::string pageUrl;
|
||||
std::string swfUrl;
|
||||
double objectEncoding;
|
||||
|
||||
std::string schema;
|
||||
std::string vhost;
|
||||
|
@ -53,6 +54,9 @@ struct SrsRequest
|
|||
std::string app;
|
||||
std::string stream;
|
||||
|
||||
SrsRequest();
|
||||
virtual ~SrsRequest();
|
||||
|
||||
/**
|
||||
* disconvery vhost/app from tcUrl.
|
||||
*/
|
||||
|
@ -91,7 +95,7 @@ public:
|
|||
* using the Limit type field.
|
||||
*/
|
||||
virtual int set_peer_bandwidth(int bandwidth, int type);
|
||||
virtual int response_connect_app();
|
||||
virtual int response_connect_app(SrsRequest* req);
|
||||
virtual int on_bw_done();
|
||||
/**
|
||||
* recv some message to identify the client.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue