winlin

fix the aggregate bug, adjust to starttime of msg. 2.0.91

@@ -1481,6 +1481,9 @@ int SrsSource::on_aggregate(SrsCommonMessage* msg) @@ -1481,6 +1481,9 @@ int SrsSource::on_aggregate(SrsCommonMessage* msg)
1481 return ret; 1481 return ret;
1482 } 1482 }
1483 1483
  1484 + // the aggregate message always use abs time.
  1485 + int delta = -1;
  1486 +
1484 while (!stream->empty()) { 1487 while (!stream->empty()) {
1485 if (!stream->require(1)) { 1488 if (!stream->require(1)) {
1486 ret = ERROR_RTMP_AGGREGATE; 1489 ret = ERROR_RTMP_AGGREGATE;
@@ -1519,6 +1522,12 @@ int SrsSource::on_aggregate(SrsCommonMessage* msg) @@ -1519,6 +1522,12 @@ int SrsSource::on_aggregate(SrsCommonMessage* msg)
1519 timestamp |= time_h<<24; 1522 timestamp |= time_h<<24;
1520 timestamp &= 0x7FFFFFFF; 1523 timestamp &= 0x7FFFFFFF;
1521 1524
  1525 + // adjust abs timestamp in aggregate msg.
  1526 + if (delta < 0) {
  1527 + delta = (int)msg->header.timestamp - (int)timestamp;
  1528 + }
  1529 + timestamp += delta;
  1530 +
1522 if (!stream->require(3)) { 1531 if (!stream->require(3)) {
1523 ret = ERROR_RTMP_AGGREGATE; 1532 ret = ERROR_RTMP_AGGREGATE;
1524 srs_error("invalid aggregate message stream_id. ret=%d", ret); 1533 srs_error("invalid aggregate message stream_id. ret=%d", ret);
@@ -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 90 34 +#define VERSION_REVISION 91
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"
@@ -823,7 +823,9 @@ int __srs_rtmp_on_aggregate(Context* context, SrsCommonMessage* msg) @@ -823,7 +823,9 @@ int __srs_rtmp_on_aggregate(Context* context, SrsCommonMessage* msg)
823 return ret; 823 return ret;
824 } 824 }
825 825
  826 + // the aggregate message always use abs time.
826 int delta = -1; 827 int delta = -1;
  828 +
827 while (!stream->empty()) { 829 while (!stream->empty()) {
828 if (!stream->require(1)) { 830 if (!stream->require(1)) {
829 ret = ERROR_RTMP_AGGREGATE; 831 ret = ERROR_RTMP_AGGREGATE;
@@ -862,7 +864,7 @@ int __srs_rtmp_on_aggregate(Context* context, SrsCommonMessage* msg) @@ -862,7 +864,7 @@ int __srs_rtmp_on_aggregate(Context* context, SrsCommonMessage* msg)
862 timestamp |= time_h<<24; 864 timestamp |= time_h<<24;
863 timestamp &= 0x7FFFFFFF; 865 timestamp &= 0x7FFFFFFF;
864 866
865 - // adjust timestamp. 867 + // adjust abs timestamp in aggregate msg.
866 if (delta < 0) { 868 if (delta < 0) {
867 delta = (int)msg->header.timestamp - (int)timestamp; 869 delta = (int)msg->header.timestamp - (int)timestamp;
868 } 870 }