event.Signal();
}
- output_surface_manager_->NotifySurfaceRelease(
- collection_token_,
- ui::OutputSurfaceManager::SurfaceReleaseType::kPermanent);
+ output_surface_manager_->NotifyCollectionRelease(collection_token_);
HideOutputIfNeeded();
event.Wait();
// Notify manager that we will no longer use output surface. It might be
// needed by new decoded for preparing. It's important to do before resource
// is released to ensure new client might safely reuse same scaler.
- output_surface_manager_->NotifySurfaceRelease(
- collection_token_,
- ui::OutputSurfaceManager::SurfaceReleaseType::kTemporary);
+ output_surface_manager_->NotifyCollectionRelease(collection_token_);
std::move(token_provider).Run(std::move(allocated_decoder_));
decoder_state_ = DecoderState::kLazyInitializeProcess;
// Notify this collection is renderable, because it could be blocked by
// resource conflict before suspending this process.
- output_surface_manager_->ClearSurfaceReleaseNotification(collection_token_);
+ output_surface_manager_->NotifyCollectionCreate(collection_token_);
InitializeInternal();
}
// Step 1: remove all the surfaces that where already released, but player
// still holds video frames and tries to render them.
for (auto it = candidates.begin(); it != candidates.end();) {
- if (released_collections_.find(it->second) == released_collections_.end()) {
+ if (alive_collections_.find(it->second) != alive_collections_.end()) {
++it;
} else {
TIZEN_MEDIA_LOG(VERBOSE)
base::UnguessableToken collection_token,
base::RepeatingCallback<void(bool)> surface_ready_cb) {
base::AutoLock auto_lock(lock_);
+ alive_collections_.insert(collection_token);
// TODO(vdwasm) We should destinguish newly created process from the suspended
// one. It's highly propable that new process will be set
surface_ready_cb);
}
-void OutputSurfaceManager::NotifySurfaceRelease(
- base::UnguessableToken token,
- SurfaceReleaseType release_type) {
+void OutputSurfaceManager::NotifyCollectionRelease(
+ base::UnguessableToken token) {
base::AutoLock auto_lock(lock_);
-
- if (release_type == SurfaceReleaseType::kPermanent) {
- released_collections_.erase(token);
- } else {
- released_collections_.insert(token);
- }
+ alive_collections_.erase(token);
auto it = std::find_if(scalers_.begin(), scalers_.end(),
[&token](const OutputSurfaceState& scaler) {
compositor_task_runner_);
}
-void OutputSurfaceManager::ClearSurfaceReleaseNotification(
+void OutputSurfaceManager::NotifyCollectionCreate(
base::UnguessableToken collection_token) {
base::AutoLock auto_lock(lock_);
- released_collections_.erase(collection_token);
+ alive_collections_.insert(collection_token);
}
size_t OutputSurfaceManager::NumAllocated() const {
base::UnguessableToken,
base::RepeatingCallback<void(bool)> surface_ready_cb);
- enum class SurfaceReleaseType {
- // Notification is temporary, is likely to reflect the resource conflict
- // of video decoder. It might be reverted (e.g after suspend&resume cycle)
- // using |ClearSurfaceReleaseNotification|.
- kTemporary,
- // Surface is about to be released by client permanently. Should be used
- // when it's certain that collection won't try to render anything more
- // (like decoder release).
- kPermanent,
- };
-
// Should be called to notify manager that collection identified by provided
// token will no longer use output surface, so it might be reused by other
// clients.
- void NotifySurfaceRelease(base::UnguessableToken collection_token,
- SurfaceReleaseType release_type);
- void ClearSurfaceReleaseNotification(base::UnguessableToken collection_token);
+ void NotifyCollectionRelease(base::UnguessableToken collection_token);
+ // Similar to above method, it brings collection back, so it be used for
+ // rendering some video frame.
+ void NotifyCollectionCreate(base::UnguessableToken collection_token);
// suspend_resume::SuspendResumeClient implementation.
void OnStateChange(suspend_resume::State new_state) override;
base::Lock lock_;
std::array<OutputSurfaceState, 4> scalers_ GUARDED_BY(lock_);
bool suspended_ GUARDED_BY(lock_) = true;
- std::set<base::UnguessableToken> released_collections_ GUARDED_BY(lock_);
+ std::set<base::UnguessableToken> alive_collections_ GUARDED_BY(lock_);
size_t NumAllocated() const EXCLUSIVE_LOCKS_REQUIRED(lock_);
size_t AcquireAndReturnAvailableSurfaces(size_t overlays_wanted)