Allow Sink.SetSource() to be given an empty source.

In Java, allow source to be null (pointers are not used in C++, so
this isn't necessary).
This commit is contained in:
Peter Johnson
2016-12-28 00:47:26 -08:00
parent b91ab0b44f
commit 23135d7a5a
4 changed files with 21 additions and 10 deletions

View File

@@ -671,9 +671,9 @@ void MjpegServerImpl::SetSourceImpl(std::shared_ptr<SourceImpl> source) {
if (auto thr = connThread.GetThread()) {
if (thr->m_source != source) {
bool streaming = thr->m_streaming;
if (streaming) thr->m_source->DisableSink();
if (thr->m_source && streaming) thr->m_source->DisableSink();
thr->m_source = source;
if (streaming) thr->m_source->EnableSink();
if (source && streaming) thr->m_source->EnableSink();
}
}
}