Skip to content

Commit

Permalink
Call callback even if mediaStream is not present or is closed (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Sep 4, 2019
1 parent 6df6273 commit 9326e95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erizoAPI/MediaStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,14 @@ NAN_METHOD(MediaStream::enableSlideShowBelowSpatialLayer) {

NAN_METHOD(MediaStream::getStats) {
MediaStream* obj = Nan::ObjectWrap::Unwrap<MediaStream>(info.Holder());
Nan::Callback *callback = new Nan::Callback(info[0].As<Function>());
if (!obj->me || info.Length() != 1 || obj->closed_) {
Local<Value> argv[] = {
Nan::New<v8::String>("{}").ToLocalChecked()
};
Nan::Call(*callback, 1, argv);
return;
}
Nan::Callback *callback = new Nan::Callback(info[0].As<Function>());
AsyncQueueWorker(new StatCallWorker(callback, obj->me));
}

Expand Down

0 comments on commit 9326e95

Please sign in to comment.