正在显示
7 个修改的文件
包含
33 行增加
和
9 行删除
| @@ -345,6 +345,7 @@ Remark: | @@ -345,6 +345,7 @@ Remark: | ||
| 345 | 345 | ||
| 346 | ## History | 346 | ## History |
| 347 | 347 | ||
| 348 | +* v3.0, 2015-08-28, fix [#471][bug #471], api response the width and height. 3.0.2 | ||
| 348 | * v3.0, 2015-08-25, fix [#367](https://github.com/simple-rtmp-server/srs/issues/367), support nginx-rtmp exec. 3.0.1 | 349 | * v3.0, 2015-08-25, fix [#367](https://github.com/simple-rtmp-server/srs/issues/367), support nginx-rtmp exec. 3.0.1 |
| 349 | * <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> | 350 | * <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> |
| 350 | * v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx. | 351 | * v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx. |
| @@ -1001,6 +1002,7 @@ Winlin | @@ -1001,6 +1002,7 @@ Winlin | ||
| 1001 | [bug #133]: https://github.com/simple-rtmp-server/srs/issues/133 | 1002 | [bug #133]: https://github.com/simple-rtmp-server/srs/issues/133 |
| 1002 | [bug #92]: https://github.com/simple-rtmp-server/srs/issues/92 | 1003 | [bug #92]: https://github.com/simple-rtmp-server/srs/issues/92 |
| 1003 | [bug #367]: https://github.com/simple-rtmp-server/srs/issues/367 | 1004 | [bug #367]: https://github.com/simple-rtmp-server/srs/issues/367 |
| 1005 | +[bug #471]: https://github.com/simple-rtmp-server/srs/issues/471 | ||
| 1004 | 1006 | ||
| 1005 | 1007 | ||
| 1006 | [contact]: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Contact | 1008 | [contact]: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Contact |
| @@ -695,7 +695,7 @@ int SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -695,7 +695,7 @@ int SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 695 | SrsStatisticVhost* vhost = NULL; | 695 | SrsStatisticVhost* vhost = NULL; |
| 696 | 696 | ||
| 697 | if (vid > 0 && (vhost = stat->find_vhost(vid)) == NULL) { | 697 | if (vid > 0 && (vhost = stat->find_vhost(vid)) == NULL) { |
| 698 | - ret = ERROR_RTMP_STREAM_NOT_FOUND; | 698 | + ret = ERROR_RTMP_VHOST_NOT_FOUND; |
| 699 | srs_error("vhost id=%d not found. ret=%d", vid, ret); | 699 | srs_error("vhost id=%d not found. ret=%d", vid, ret); |
| 700 | return srs_api_response_code(w, r, ret); | 700 | return srs_api_response_code(w, r, ret); |
| 701 | } | 701 | } |
| @@ -750,7 +750,7 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -750,7 +750,7 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 750 | SrsStatisticStream* stream = NULL; | 750 | SrsStatisticStream* stream = NULL; |
| 751 | if (sid >= 0 && (stream = stat->find_stream(sid)) == NULL) { | 751 | if (sid >= 0 && (stream = stat->find_stream(sid)) == NULL) { |
| 752 | ret = ERROR_RTMP_STREAM_NOT_FOUND; | 752 | ret = ERROR_RTMP_STREAM_NOT_FOUND; |
| 753 | - srs_error("stream stream_id=%d not found. ret=%d", sid, ret); | 753 | + srs_error("stream id=%d not found. ret=%d", sid, ret); |
| 754 | return srs_api_response_code(w, r, ret); | 754 | return srs_api_response_code(w, r, ret); |
| 755 | } | 755 | } |
| 756 | 756 | ||
| @@ -803,8 +803,8 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -803,8 +803,8 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 803 | 803 | ||
| 804 | SrsStatisticClient* client = NULL; | 804 | SrsStatisticClient* client = NULL; |
| 805 | if (cid >= 0 && (client = stat->find_client(cid)) == NULL) { | 805 | if (cid >= 0 && (client = stat->find_client(cid)) == NULL) { |
| 806 | - ret = ERROR_RTMP_STREAM_NOT_FOUND; | ||
| 807 | - srs_error("stream client_id=%d not found. ret=%d", cid, ret); | 806 | + ret = ERROR_RTMP_CLIENT_NOT_FOUND; |
| 807 | + srs_error("client id=%d not found. ret=%d", cid, ret); | ||
| 808 | return srs_api_response_code(w, r, ret); | 808 | return srs_api_response_code(w, r, ret); |
| 809 | } | 809 | } |
| 810 | 810 | ||
| @@ -830,6 +830,15 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -830,6 +830,15 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 830 | return srs_api_response_code(w, r, ret); | 830 | return srs_api_response_code(w, r, ret); |
| 831 | } | 831 | } |
| 832 | } | 832 | } |
| 833 | + } else if (r->is_http_delete()) { | ||
| 834 | + if (!client) { | ||
| 835 | + ret = ERROR_RTMP_CLIENT_NOT_FOUND; | ||
| 836 | + srs_error("client id=%d not found. ret=%d", cid, ret); | ||
| 837 | + return srs_api_response_code(w, r, ret); | ||
| 838 | + } | ||
| 839 | + | ||
| 840 | + client->conn->expire(); | ||
| 841 | + srs_warn("kickoff client id=%d", cid); | ||
| 833 | } else { | 842 | } else { |
| 834 | return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed); | 843 | return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed); |
| 835 | } | 844 | } |
| @@ -1893,7 +1893,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) | @@ -1893,7 +1893,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) | ||
| 1893 | 1893 | ||
| 1894 | // when got video stream info. | 1894 | // when got video stream info. |
| 1895 | SrsStatistic* stat = SrsStatistic::instance(); | 1895 | SrsStatistic* stat = SrsStatistic::instance(); |
| 1896 | - if ((ret = stat->on_video_info(_req, SrsCodecVideoAVC, codec.avc_profile, codec.avc_level)) != ERROR_SUCCESS) { | 1896 | + if ((ret = stat->on_video_info(_req, SrsCodecVideoAVC, codec.avc_profile, codec.avc_level, codec.width, codec.height)) != ERROR_SUCCESS) { |
| 1897 | return ret; | 1897 | return ret; |
| 1898 | } | 1898 | } |
| 1899 | 1899 |
| @@ -108,6 +108,8 @@ SrsStatisticStream::SrsStatisticStream() | @@ -108,6 +108,8 @@ SrsStatisticStream::SrsStatisticStream() | ||
| 108 | asample_rate = SrsCodecAudioSampleRateReserved; | 108 | asample_rate = SrsCodecAudioSampleRateReserved; |
| 109 | asound_type = SrsCodecAudioSoundTypeReserved; | 109 | asound_type = SrsCodecAudioSoundTypeReserved; |
| 110 | aac_object = SrsAacObjectTypeReserved; | 110 | aac_object = SrsAacObjectTypeReserved; |
| 111 | + width = 0; | ||
| 112 | + height = 0; | ||
| 111 | 113 | ||
| 112 | kbps = new SrsKbps(); | 114 | kbps = new SrsKbps(); |
| 113 | kbps->set_io(NULL, NULL); | 115 | kbps->set_io(NULL, NULL); |
| @@ -154,6 +156,8 @@ int SrsStatisticStream::dumps(SrsAmf0Object* obj) | @@ -154,6 +156,8 @@ int SrsStatisticStream::dumps(SrsAmf0Object* obj) | ||
| 154 | video->set("codec", SrsAmf0Any::str(srs_codec_video2str(vcodec).c_str())); | 156 | video->set("codec", SrsAmf0Any::str(srs_codec_video2str(vcodec).c_str())); |
| 155 | video->set("profile", SrsAmf0Any::str(srs_codec_avc_profile2str(avc_profile).c_str())); | 157 | video->set("profile", SrsAmf0Any::str(srs_codec_avc_profile2str(avc_profile).c_str())); |
| 156 | video->set("level", SrsAmf0Any::str(srs_codec_avc_level2str(avc_level).c_str())); | 158 | video->set("level", SrsAmf0Any::str(srs_codec_avc_level2str(avc_level).c_str())); |
| 159 | + video->set("width", SrsAmf0Any::number(width)); | ||
| 160 | + video->set("height", SrsAmf0Any::number(height)); | ||
| 157 | } | 161 | } |
| 158 | 162 | ||
| 159 | if (!has_audio) { | 163 | if (!has_audio) { |
| @@ -216,7 +220,7 @@ int SrsStatisticClient::dumps(SrsAmf0Object* obj) | @@ -216,7 +220,7 @@ int SrsStatisticClient::dumps(SrsAmf0Object* obj) | ||
| 216 | obj->set("url", SrsAmf0Any::str(req->get_stream_url().c_str())); | 220 | obj->set("url", SrsAmf0Any::str(req->get_stream_url().c_str())); |
| 217 | obj->set("type", SrsAmf0Any::str(srs_client_type_string(type).c_str())); | 221 | obj->set("type", SrsAmf0Any::str(srs_client_type_string(type).c_str())); |
| 218 | obj->set("publish", SrsAmf0Any::boolean(srs_client_type_is_publish(type))); | 222 | obj->set("publish", SrsAmf0Any::boolean(srs_client_type_is_publish(type))); |
| 219 | - obj->set("alive", SrsAmf0Any::number(srs_get_system_time_ms() - create)); | 223 | + obj->set("alive", SrsAmf0Any::number((srs_get_system_time_ms() - create) / 1000.0)); |
| 220 | 224 | ||
| 221 | return ret; | 225 | return ret; |
| 222 | } | 226 | } |
| @@ -305,7 +309,8 @@ SrsStatisticClient* SrsStatistic::find_client(int cid) | @@ -305,7 +309,8 @@ SrsStatisticClient* SrsStatistic::find_client(int cid) | ||
| 305 | } | 309 | } |
| 306 | 310 | ||
| 307 | int SrsStatistic::on_video_info(SrsRequest* req, | 311 | int SrsStatistic::on_video_info(SrsRequest* req, |
| 308 | - SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level | 312 | + SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level, |
| 313 | + int width, int height | ||
| 309 | ) { | 314 | ) { |
| 310 | int ret = ERROR_SUCCESS; | 315 | int ret = ERROR_SUCCESS; |
| 311 | 316 | ||
| @@ -317,6 +322,9 @@ int SrsStatistic::on_video_info(SrsRequest* req, | @@ -317,6 +322,9 @@ int SrsStatistic::on_video_info(SrsRequest* req, | ||
| 317 | stream->avc_profile = avc_profile; | 322 | stream->avc_profile = avc_profile; |
| 318 | stream->avc_level = avc_level; | 323 | stream->avc_level = avc_level; |
| 319 | 324 | ||
| 325 | + stream->width = width; | ||
| 326 | + stream->height = height; | ||
| 327 | + | ||
| 320 | return ret; | 328 | return ret; |
| 321 | } | 329 | } |
| 322 | 330 |
| @@ -84,6 +84,9 @@ public: | @@ -84,6 +84,9 @@ public: | ||
| 84 | SrsAvcProfile avc_profile; | 84 | SrsAvcProfile avc_profile; |
| 85 | // level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45. | 85 | // level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45. |
| 86 | SrsAvcLevel avc_level; | 86 | SrsAvcLevel avc_level; |
| 87 | + // the width and height in codec info. | ||
| 88 | + int width; | ||
| 89 | + int height; | ||
| 87 | public: | 90 | public: |
| 88 | bool has_audio; | 91 | bool has_audio; |
| 89 | SrsCodecAudio acodec; | 92 | SrsCodecAudio acodec; |
| @@ -166,7 +169,8 @@ public: | @@ -166,7 +169,8 @@ public: | ||
| 166 | * when got video info for stream. | 169 | * when got video info for stream. |
| 167 | */ | 170 | */ |
| 168 | virtual int on_video_info(SrsRequest* req, | 171 | virtual int on_video_info(SrsRequest* req, |
| 169 | - SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level | 172 | + SrsCodecVideo vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level, |
| 173 | + int width, int height | ||
| 170 | ); | 174 | ); |
| 171 | /** | 175 | /** |
| 172 | * when got audio info for stream. | 176 | * when got audio info for stream. |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR 3 | 32 | #define VERSION_MAJOR 3 |
| 33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
| 34 | -#define VERSION_REVISION 1 | 34 | +#define VERSION_REVISION 2 |
| 35 | 35 | ||
| 36 | // server info. | 36 | // server info. |
| 37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
| @@ -154,6 +154,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -154,6 +154,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 154 | #define ERROR_RTP_TYPE97_CORRUPT 2046 | 154 | #define ERROR_RTP_TYPE97_CORRUPT 2046 |
| 155 | #define ERROR_RTSP_AUDIO_CONFIG 2047 | 155 | #define ERROR_RTSP_AUDIO_CONFIG 2047 |
| 156 | #define ERROR_RTMP_STREAM_NOT_FOUND 2048 | 156 | #define ERROR_RTMP_STREAM_NOT_FOUND 2048 |
| 157 | +#define ERROR_RTMP_CLIENT_NOT_FOUND 2049 | ||
| 157 | // | 158 | // |
| 158 | // system control message, | 159 | // system control message, |
| 159 | // not an error, but special control logic. | 160 | // not an error, but special control logic. |
-
请 注册 或 登录 后发表评论