winlin

set metadata time equals to sequence header time.

@@ -1250,15 +1250,12 @@ void SrsSource::on_unpublish() @@ -1250,15 +1250,12 @@ void SrsSource::on_unpublish()
1250 1250
1251 double queue_size = _srs_config->get_queue_length(_req->vhost); 1251 double queue_size = _srs_config->get_queue_length(_req->vhost);
1252 consumer->set_queue_size(queue_size); 1252 consumer->set_queue_size(queue_size);
1253 -  
1254 - if (cache_metadata && (ret = consumer->enqueue(cache_metadata->copy(), sample_rate, frame_rate)) != ERROR_SUCCESS) {  
1255 - srs_error("dispatch metadata failed. ret=%d", ret);  
1256 - return ret;  
1257 - }  
1258 - srs_info("dispatch metadata success");  
1259 1253
1260 // if atc, update the sequence header to gop cache time. 1254 // if atc, update the sequence header to gop cache time.
1261 if (atc && !gop_cache->empty()) { 1255 if (atc && !gop_cache->empty()) {
  1256 + if (cache_metadata) {
  1257 + cache_metadata->header.timestamp = gop_cache->get_start_time();
  1258 + }
1262 if (cache_sh_video) { 1259 if (cache_sh_video) {
1263 cache_sh_video->header.timestamp = gop_cache->get_start_time(); 1260 cache_sh_video->header.timestamp = gop_cache->get_start_time();
1264 } 1261 }
@@ -1266,6 +1263,13 @@ void SrsSource::on_unpublish() @@ -1266,6 +1263,13 @@ void SrsSource::on_unpublish()
1266 cache_sh_audio->header.timestamp = gop_cache->get_start_time(); 1263 cache_sh_audio->header.timestamp = gop_cache->get_start_time();
1267 } 1264 }
1268 } 1265 }
  1266 +
  1267 + // copy metadata.
  1268 + if (cache_metadata && (ret = consumer->enqueue(cache_metadata->copy(), sample_rate, frame_rate)) != ERROR_SUCCESS) {
  1269 + srs_error("dispatch metadata failed. ret=%d", ret);
  1270 + return ret;
  1271 + }
  1272 + srs_info("dispatch metadata success");
1269 1273
1270 // copy sequence header 1274 // copy sequence header
1271 if (cache_sh_video && (ret = consumer->enqueue(cache_sh_video->copy(), sample_rate, frame_rate)) != ERROR_SUCCESS) { 1275 if (cache_sh_video && (ret = consumer->enqueue(cache_sh_video->copy(), sample_rate, frame_rate)) != ERROR_SUCCESS) {