mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #87: add source id for full trackable log. 0.9.120
This commit is contained in:
parent
b28593894b
commit
978e985519
6 changed files with 34 additions and 6 deletions
|
@ -248,6 +248,7 @@ SrsConsumer::SrsConsumer(SrsSource* _source)
|
|||
paused = false;
|
||||
jitter = new SrsRtmpJitter();
|
||||
queue = new SrsMessageQueue();
|
||||
should_update_source_id = false;
|
||||
}
|
||||
|
||||
SrsConsumer::~SrsConsumer()
|
||||
|
@ -262,6 +263,11 @@ void SrsConsumer::set_queue_size(double queue_size)
|
|||
queue->set_queue_size(queue_size);
|
||||
}
|
||||
|
||||
void SrsConsumer::update_source_id()
|
||||
{
|
||||
should_update_source_id = true;
|
||||
}
|
||||
|
||||
int SrsConsumer::get_time()
|
||||
{
|
||||
return jitter->get_time();
|
||||
|
@ -287,6 +293,11 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg, int tba, int tbv)
|
|||
|
||||
int SrsConsumer::get_packets(int max_count, SrsSharedPtrMessage**& pmsgs, int& count)
|
||||
{
|
||||
if (should_update_source_id) {
|
||||
srs_trace("update source_id=%d", source->source_id());
|
||||
should_update_source_id = false;
|
||||
}
|
||||
|
||||
// paused, return nothing.
|
||||
if (paused) {
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -802,6 +813,13 @@ int SrsSource::on_source_id_changed(int id)
|
|||
|
||||
_source_id = id;
|
||||
|
||||
// notice all consumer
|
||||
std::vector<SrsConsumer*>::iterator it;
|
||||
for (it = consumers.begin(); it != consumers.end(); ++it) {
|
||||
SrsConsumer* consumer = *it;
|
||||
consumer->update_source_id();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue