Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Jul 22, 2022
1 parent ae4dd41 commit 703ae40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sdk/objc/native/src/objc_desktop_media_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ObjCDesktopMediaList : public rtc::MessageHandler {

virtual MediaSource* GetSource(int index);

virtual bool GetThumbnail(MediaSource *source);
virtual bool GetThumbnail(MediaSource *source, bool notify);

protected:
virtual void OnMessage(rtc::Message* msg) override;
Expand Down
9 changes: 5 additions & 4 deletions sdk/objc/native/src/objc_desktop_media_list.mm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
if (old_source_set.find(new_sources[i].id) == old_source_set.end()) {
MediaSource* source = new MediaSource(this, new_sources[i],type_);
sources_.insert(sources_.begin() + i, std::shared_ptr<MediaSource>(source));
GetThumbnail(source, false);
[objcMediaList_ mediaSourceAdded:source];
}
}
Expand Down Expand Up @@ -127,18 +128,18 @@

if(get_thumbnail) {
for( auto source : sources_) {
GetThumbnail(source.get());
GetThumbnail(source.get(), true);
}
}
return sources_.size();
}

bool ObjCDesktopMediaList::GetThumbnail(MediaSource *source) {
bool ObjCDesktopMediaList::GetThumbnail(MediaSource *source, bool notify) {
callback_->SetCallback([&](webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) {
auto old_thumbnail = source->thumbnail();
source->SaveCaptureResult(result, std::move(frame));
if(old_thumbnail.size() != source->thumbnail().size()) {
if(old_thumbnail.size() != source->thumbnail().size() && notify) {
[objcMediaList_ mediaSourceThumbnailChanged:source];
}
});
Expand All @@ -158,7 +159,7 @@
}

bool MediaSource::UpdateThumbnail() {
return mediaList_->GetThumbnail(this);
return mediaList_->GetThumbnail(this, true);
}

void MediaSource::SaveCaptureResult(webrtc::DesktopCapturer::Result result,
Expand Down

0 comments on commit 703ae40

Please sign in to comment.