mirror of
https://github.com/ossrs/srs.git
synced 2025-02-14 12:21:55 +00:00
fix #471, api response the width and height. 3.0.2
This commit is contained in:
parent
04bea781ca
commit
1b1a2a1e63
7 changed files with 33 additions and 9 deletions
|
@ -345,6 +345,7 @@ Remark:
|
|||
|
||||
## History
|
||||
|
||||
* v3.0, 2015-08-28, fix [#471][bug #471], api response the width and height. 3.0.2
|
||||
* v3.0, 2015-08-25, fix [#367](https://github.com/simple-rtmp-server/srs/issues/367), support nginx-rtmp exec. 3.0.1
|
||||
* <strong>v2.0, 2015-08-23, [2.0 alpha(2.0.185)](https://github.com/simple-rtmp-server/srs/releases/tag/2.0a0) released. 89022 lines.</strong>
|
||||
* v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx.
|
||||
|
@ -1001,6 +1002,7 @@ Winlin
|
|||
[bug #133]: https://github.com/simple-rtmp-server/srs/issues/133
|
||||
[bug #92]: https://github.com/simple-rtmp-server/srs/issues/92
|
||||
[bug #367]: https://github.com/simple-rtmp-server/srs/issues/367
|
||||
[bug #471]: https://github.com/simple-rtmp-server/srs/issues/471
|
||||
|
||||
|
||||
[contact]: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Contact
|
||||
|
|
|
@ -695,7 +695,7 @@ int SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
SrsStatisticVhost* vhost = NULL;
|
||||
|
||||
if (vid > 0 && (vhost = stat->find_vhost(vid)) == NULL) {
|
||||
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
||||
ret = ERROR_RTMP_VHOST_NOT_FOUND;
|
||||
srs_error("vhost id=%d not found. ret=%d", vid, ret);
|
||||
return srs_api_response_code(w, r, ret);
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
SrsStatisticStream* stream = NULL;
|
||||
if (sid >= 0 && (stream = stat->find_stream(sid)) == NULL) {
|
||||
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
||||
srs_error("stream stream_id=%d not found. ret=%d", sid, ret);
|
||||
srs_error("stream id=%d not found. ret=%d", sid, ret);
|
||||
return srs_api_response_code(w, r, ret);
|
||||
}
|
||||
|
||||
|
@ -803,8 +803,8 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
|
||||
SrsStatisticClient* client = NULL;
|
||||
if (cid >= 0 && (client = stat->find_client(cid)) == NULL) {
|
||||
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
||||
srs_error("stream client_id=%d not found. ret=%d", cid, ret);
|
||||
ret = ERROR_RTMP_CLIENT_NOT_FOUND;
|
||||
srs_error("client id=%d not found. ret=%d", cid, ret);
|
||||
return srs_api_response_code(w, r, ret);
|
||||
}
|
||||
|
||||
|
@ -830,6 +830,15 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
return srs_api_response_code(w, r, ret);
|
||||
}
|
||||
}
|
||||
} else if (r->is_http_delete()) {
|
||||
if (!client) {
|
||||
ret = ERROR_RTMP_CLIENT_NOT_FOUND;
|
||||
srs_error("client id=%d not found. ret=%d", cid, ret);
|
||||
return srs_api_response_code(w, r, ret);
|
||||
}
|
||||
|
||||
client->conn->expire();
|
||||
srs_warn("kickoff client id=%d", cid);
|
||||
} else {
|
||||
return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed);
|
||||
}
|
||||
|
|
|
@ -1893,7 +1893,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
|
||||
// when got video stream info.
|
||||
SrsStatistic* stat = SrsStatistic::instance();
|
||||
if ((ret = stat->on_video_info(_req, SrsCodecVideoAVC, codec.avc_profile, codec.avc_level)) != ERROR_SUCCESS) {
|
||||
if ((ret = stat->on_video_info(_req, SrsCodecVideoAVC, codec.avc_profile, codec.avc_level, codec.width, codec.height)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ SrsStatisticStream::SrsStatisticStream()
|
|||
asample_rate = SrsCodecAudioSampleRateReserved;
|
||||
asound_type = SrsCodecAudioSoundTypeReserved;
|
||||
aac_object = SrsAacObjectTypeReserved;
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
kbps = new SrsKbps();
|
||||
kbps->set_io(NULL, NULL);
|
||||
|
@ -154,6 +156,8 @@ int SrsStatisticStream::dumps(SrsAmf0Object* obj)
|
|||
video->set("codec", SrsAmf0Any::str(srs_codec_video2str(vcodec).c_str()));
|
||||
video->set("profile", SrsAmf0Any::str(srs_codec_avc_profile2str(avc_profile).c_str()));
|
||||
video->set("level", SrsAmf0Any::str(srs_codec_avc_level2str(avc_level).c_str()));
|
||||
video->set("width", SrsAmf0Any::number(width));
|
||||
video->set("height", SrsAmf0Any::number(height));
|
||||
}
|
||||
|
||||
if (!has_audio) {
|
||||
|
@ -216,7 +220,7 @@ int SrsStatisticClient::dumps(SrsAmf0Object* obj)
|
|||
obj->set("url", SrsAmf0Any::str(req->get_stream_url().c_str()));
|
||||
obj->set("type", SrsAmf0Any::str(srs_client_type_string(type).c_str()));
|
||||
obj->set("publish", SrsAmf0Any::boolean(srs_client_type_is_publish(type)));
|
||||
obj->set("alive", SrsAmf0Any::number(srs_get_system_time_ms() - create));
|
||||
obj->set("alive", SrsAmf0Any::number((srs_get_system_time_ms() - create) / 1000.0));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -305,7 +309,8 @@ SrsStatisticClient* SrsStatistic::find_client(int cid)
|
|||
}
|
||||
|
||||
int SrsStatistic::on_video_info(SrsRequest* req,
|
||||
SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level
|
||||
SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level,
|
||||
int width, int height
|
||||
) {
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -317,6 +322,9 @@ int SrsStatistic::on_video_info(SrsRequest* req,
|
|||
stream->avc_profile = avc_profile;
|
||||
stream->avc_level = avc_level;
|
||||
|
||||
stream->width = width;
|
||||
stream->height = height;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,9 @@ public:
|
|||
SrsAvcProfile avc_profile;
|
||||
// level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
||||
SrsAvcLevel avc_level;
|
||||
// the width and height in codec info.
|
||||
int width;
|
||||
int height;
|
||||
public:
|
||||
bool has_audio;
|
||||
SrsCodecAudio acodec;
|
||||
|
@ -166,7 +169,8 @@ public:
|
|||
* when got video info for stream.
|
||||
*/
|
||||
virtual int on_video_info(SrsRequest* req,
|
||||
SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level
|
||||
SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level,
|
||||
int width, int height
|
||||
);
|
||||
/**
|
||||
* when got audio info for stream.
|
||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// current release version
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_REVISION 2
|
||||
|
||||
// server info.
|
||||
#define RTMP_SIG_SRS_KEY "SRS"
|
||||
|
|
|
@ -154,6 +154,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define ERROR_RTP_TYPE97_CORRUPT 2046
|
||||
#define ERROR_RTSP_AUDIO_CONFIG 2047
|
||||
#define ERROR_RTMP_STREAM_NOT_FOUND 2048
|
||||
#define ERROR_RTMP_CLIENT_NOT_FOUND 2049
|
||||
//
|
||||
// system control message,
|
||||
// not an error, but special control logic.
|
||||
|
|
Loading…
Reference in a new issue