1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

APM: Support distributed tracing by Tencent Cloud APM. v5.0.63

This commit is contained in:
winlin 2022-08-24 11:04:39 +08:00
parent 736c661808
commit 3e2f8622f8
49 changed files with 4989 additions and 719 deletions

View file

@ -136,6 +136,26 @@ srs_error_t SrsProtobufVarints::encode(SrsBuffer* b, uint64_t v)
return err;
}
int SrsProtobufFixed64::sizeof_int(uint64_t v)
{
return 8;
}
srs_error_t SrsProtobufFixed64::encode(SrsBuffer* b, uint64_t v)
{
srs_error_t err = srs_success;
if (!b->require(8)) {
return srs_error_new(ERROR_PB_NO_SPACE, "require 8 only %d byte", b->left());
}
// Encode values in little-endian byte order,
// see https://developers.google.com/protocol-buffers/docs/encoding#non-varint_numbers
b->write_le8bytes((int64_t)v);
return err;
}
// See Go protowire.SizeBytes of package google.golang.org/protobuf/encoding/protowire
int SrsProtobufString::sizeof_string(const std::string& v)
{

View file

@ -24,6 +24,14 @@ public:
static srs_error_t encode(SrsBuffer* b, uint64_t v);
};
// See https://developers.google.com/protocol-buffers/docs/encoding#structure
class SrsProtobufFixed64
{
public:
static int sizeof_int(uint64_t v);
static srs_error_t encode(SrsBuffer* b, uint64_t v);
};
// See https://developers.google.com/protocol-buffers/docs/encoding#strings
class SrsProtobufString
{
@ -44,6 +52,7 @@ public:
enum SrsProtobufField
{
// For int32, int64, uint32, uint64, sint32, sint64, bool, enum
SrsProtobufFieldEnum = 0,
SrsProtobufFieldVarint = 0,
// For fixed64, sfixed64, double
SrsProtobufField64bit = 1,

View file

@ -41,6 +41,14 @@ SrsBasicRtmpClient::~SrsBasicRtmpClient()
srs_freep(req);
}
SrsAmf0Object* SrsBasicRtmpClient::extra_args()
{
if (req->args == NULL) {
req->args = SrsAmf0Any::object();
}
return req->args;
}
srs_error_t SrsBasicRtmpClient::connect()
{
srs_error_t err = srs_success;
@ -89,13 +97,8 @@ srs_error_t SrsBasicRtmpClient::do_connect_app(string local_ip, bool debug)
{
srs_error_t err = srs_success;
// args of request takes the srs info.
if (req->args == NULL) {
req->args = SrsAmf0Any::object();
}
// notify server the edge identity,
SrsAmf0Object* data = req->args;
SrsAmf0Object* data = extra_args();
data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY));
data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER));
data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE));

View file

@ -19,6 +19,7 @@ class SrsSharedPtrMessage;
class SrsPacket;
class SrsNetworkKbps;
class SrsWallClock;
class SrsAmf0Object;
// The simple RTMP client, provides friendly APIs.
// @remark Should never use client when closed.
@ -47,6 +48,9 @@ public:
// @param stm The timeout in srs_utime_t to delivery A/V stream.
SrsBasicRtmpClient(std::string r, srs_utime_t ctm, srs_utime_t stm);
virtual ~SrsBasicRtmpClient();
public:
// Get extra args to carry more information.
SrsAmf0Object* extra_args();
public:
// Connect, handshake and connect app to RTMP server.
// @remark We always close the transport.

View file

@ -1897,7 +1897,7 @@ srs_error_t SrsRtmpClient::connect_app(string app, string tcUrl, SrsRequest* r,
// @see https://github.com/ossrs/srs/issues/160
// the debug_srs_upnode is config in vhost and default to true.
if (dsu && r && r->args) {
if (dsu && r && r->args && r->args->count() > 0) {
srs_freep(pkt->args);
pkt->args = r->args->copy()->to_object();
}