winlin

fix #418, ignore null connect props to make RED5 happy. 2.0.204

@@ -337,6 +337,7 @@ Remark: @@ -337,6 +337,7 @@ Remark:
337 337
338 ## History 338 ## History
339 339
  340 +* v2.0, 2015-12-22, for [#418][bug #418] ignore null connect props to make RED5 happy. 2.0.204
340 * v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203 341 * v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203
341 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202 342 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202
342 * v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201 343 * v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201
@@ -1211,6 +1212,7 @@ Winlin @@ -1211,6 +1212,7 @@ Winlin
1211 [bug #518]: https://github.com/ossrs/srs/issues/518 1212 [bug #518]: https://github.com/ossrs/srs/issues/518
1212 [bug #541]: https://github.com/ossrs/srs/issues/541 1213 [bug #541]: https://github.com/ossrs/srs/issues/541
1213 [bug #546]: https://github.com/ossrs/srs/issues/546 1214 [bug #546]: https://github.com/ossrs/srs/issues/546
  1215 +[bug #418]: https://github.com/ossrs/srs/issues/418
1214 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1216 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1215 1217
1216 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1218 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -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 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 203 34 +#define VERSION_REVISION 204
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -3289,9 +3289,24 @@ int SrsConnectAppResPacket::decode(SrsStream* stream) @@ -3289,9 +3289,24 @@ int SrsConnectAppResPacket::decode(SrsStream* stream)
3289 ret = ERROR_SUCCESS; 3289 ret = ERROR_SUCCESS;
3290 } 3290 }
3291 3291
3292 - if ((ret = props->read(stream)) != ERROR_SUCCESS) {  
3293 - srs_error("amf0 decode connect props failed. ret=%d", ret);  
3294 - return ret; 3292 + // for RED5(1.0.6), the props is NULL, we must ignore it.
  3293 + // @see https://github.com/ossrs/srs/issues/418
  3294 + if (!stream->empty()) {
  3295 + SrsAmf0Any* p = NULL;
  3296 + if ((ret = srs_amf0_read_any(stream, &p)) != ERROR_SUCCESS) {
  3297 + srs_error("amf0 decode connect props failed. ret=%d", ret);
  3298 + return ret;
  3299 + }
  3300 +
  3301 + // ignore when props is not amf0 object.
  3302 + if (!p->is_object()) {
  3303 + srs_warn("ignore connect response props marker=%#x.", (u_int8_t)p->marker);
  3304 + srs_freep(p);
  3305 + } else {
  3306 + srs_freep(props);
  3307 + props = p->to_object();
  3308 + srs_info("accept amf0 object connect response props");
  3309 + }
3295 } 3310 }
3296 3311
3297 if ((ret = info->read(stream)) != ERROR_SUCCESS) { 3312 if ((ret = info->read(stream)) != ERROR_SUCCESS) {