mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine mpegts code, use simple rtmp client
This commit is contained in:
parent
ad9b377d96
commit
a08d8f83d6
5 changed files with 34 additions and 112 deletions
|
@ -198,6 +198,11 @@ int SrsSimpleRtmpClient::connect_app()
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool SrsSimpleRtmpClient::connected()
|
||||
{
|
||||
return transport->connected();
|
||||
}
|
||||
|
||||
void SrsSimpleRtmpClient::close()
|
||||
{
|
||||
transport->close();
|
||||
|
@ -266,22 +271,16 @@ int SrsSimpleRtmpClient::sid()
|
|||
return stream_id;
|
||||
}
|
||||
|
||||
int SrsSimpleRtmpClient::rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size)
|
||||
int SrsSimpleRtmpClient::rtmp_create_msg(char type, u_int32_t timestamp, char* data, int size, SrsSharedPtrMessage** pmsg)
|
||||
{
|
||||
*pmsg = NULL;
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
SrsSharedPtrMessage* msg = NULL;
|
||||
|
||||
if ((ret = srs_rtmp_create_msg(type, timestamp, data, size, stream_id, &msg)) != ERROR_SUCCESS) {
|
||||
if ((ret = srs_rtmp_create_msg(type, timestamp, data, size, stream_id, pmsg)) != ERROR_SUCCESS) {
|
||||
srs_error("sdk: create shared ptr msg failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
srs_assert(msg);
|
||||
|
||||
// send out encoded msg.
|
||||
if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue