1 /*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "media_client.h"
17 #include "avmetadatahelper_client.h"
18 #include "iservice_registry.h"
19 #include "system_ability_definition.h"
20 #include "ipc_skeleton.h"
21 #include "i_standard_monitor_service.h"
22 #include "monitor_client.h"
23 #include <thread>
24 #ifdef SUPPORT_RECORDER
25 #include "i_standard_recorder_service.h"
26 #endif
27 #ifdef SUPPORT_TRANSCODER
28 #include "i_standard_transcoder_service.h"
29 #endif
30 #ifdef SUPPORT_PLAYER
31 #include "i_standard_player_service.h"
32 #endif
33 #ifdef SUPPORT_METADATA
34 #include "i_standard_avmetadatahelper_service.h"
35 #endif
36 #ifdef SUPPORT_SCREEN_CAPTURE
37 #include "i_standard_screen_capture_service.h"
38 #include "i_standard_screen_capture_monitor_service.h"
39 #endif
40 #include "media_log.h"
41 #include "media_errors.h"
42 #include "player_xcollie.h"
43
44 namespace {
45 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_PLAYER, "MediaClient"};
46 }
47
48 namespace OHOS {
49 namespace Media {
50 constexpr int32_t LOAD_TIME = 30;
51 #ifdef SUPPORT_START_STOP_ON_DEMAND
52 constexpr int32_t SLEEP_TIME = 100;
53 constexpr int32_t RETRY_TIME = 3;
54 #endif
55 constexpr uint32_t MAX_WAIT_TIME = 5000;
56 static MediaClient g_mediaClientInstance;
GetInstance()57 IMediaService &MediaServiceFactory::GetInstance()
58 {
59 return g_mediaClientInstance;
60 }
61
MediaClient()62 MediaClient::MediaClient() noexcept
63 {
64 MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances create", FAKE_POINTER(this));
65 }
66
~MediaClient()67 MediaClient::~MediaClient()
68 {
69 MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances destroy", FAKE_POINTER(this));
70 }
71
IsAlived()72 bool MediaClient::IsAlived()
73 {
74 if (mediaProxy_ == nullptr) {
75 mediaProxy_ = GetMediaProxy();
76 }
77
78 return (mediaProxy_ != nullptr) ? true : false;
79 }
80
CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility subSystemId,sptr<IRemoteObject> & object,std::unique_lock<std::mutex> & lock)81 void MediaClient::CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility subSystemId,
82 sptr<IRemoteObject> &object, std::unique_lock<std::mutex> &lock)
83 {
84 (void)(lock);
85 #ifdef SUPPORT_START_STOP_ON_DEMAND
86 int32_t tryTimes = RETRY_TIME;
87 while (tryTimes-- > 0) {
88 if (!IsAlived()) {
89 MEDIA_LOGI("media service does not exist, sleep and retry");
90 mediaProxyUpdatedCondition_.wait_for(lock, std::chrono::milliseconds(SLEEP_TIME));
91 continue;
92 }
93 object = mediaProxy_->GetSubSystemAbilityWithTimeOut(subSystemId, listenerStub_->AsObject(), MAX_WAIT_TIME);
94 if (object != nullptr) {
95 return;
96 }
97 MEDIA_LOGI("GetSubSystemAbilityWithTimeOut failed, sleep and retry");
98 mediaProxyUpdatedCondition_.wait_for(lock, std::chrono::milliseconds(SLEEP_TIME));
99 continue;
100 }
101 #else
102 CHECK_AND_RETURN_LOG(IsAlived(), "media service does not exist.");
103 object = mediaProxy_->GetSubSystemAbility(subSystemId, listenerStub_->AsObject());
104 #endif
105 }
106
107 #ifdef SUPPORT_RECORDER
CreateRecorderService()108 std::shared_ptr<IRecorderService> MediaClient::CreateRecorderService()
109 {
110 std::unique_lock<std::mutex> lock(mutex_);
111 sptr<IRemoteObject> object = nullptr;
112
113 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_RECORDER, object, lock);
114 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "recorder proxy object is nullptr.");
115
116 sptr<IStandardRecorderService> recorderProxy = iface_cast<IStandardRecorderService>(object);
117 CHECK_AND_RETURN_RET_LOG(recorderProxy != nullptr, nullptr, "recorder proxy is nullptr.");
118
119 std::shared_ptr<RecorderClient> recorder = RecorderClient::Create(recorderProxy);
120 CHECK_AND_RETURN_RET_LOG(recorder != nullptr, nullptr, "failed to create recorder client.");
121
122 recorderClientList_.push_back(recorder);
123 return recorder;
124 }
125
DestroyMediaProfileService(std::shared_ptr<IRecorderProfilesService> recorderProfiles)126 int32_t MediaClient::DestroyMediaProfileService(std::shared_ptr<IRecorderProfilesService> recorderProfiles)
127 {
128 std::lock_guard<std::mutex> lock(mutex_);
129 CHECK_AND_RETURN_RET_LOG(recorderProfiles != nullptr, MSERR_NO_MEMORY, "input recorderProfiles is nullptr.");
130 recorderProfilesClientList_.remove(recorderProfiles);
131 return MSERR_OK;
132 }
133
DestroyRecorderService(std::shared_ptr<IRecorderService> recorder)134 int32_t MediaClient::DestroyRecorderService(std::shared_ptr<IRecorderService> recorder)
135 {
136 std::lock_guard<std::mutex> lock(mutex_);
137 CHECK_AND_RETURN_RET_LOG(recorder != nullptr, MSERR_NO_MEMORY, "input recorder is nullptr.");
138 recorderClientList_.remove(recorder);
139 return MSERR_OK;
140 }
141
CreateRecorderProfilesService()142 std::shared_ptr<IRecorderProfilesService> MediaClient::CreateRecorderProfilesService()
143 {
144 std::unique_lock<std::mutex> lock(mutex_);
145 sptr<IRemoteObject> object = nullptr;
146 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::RECORDER_PROFILES, object, lock);
147 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "recorderProfiles proxy object is nullptr.");
148
149 sptr<IStandardRecorderProfilesService> recorderProfilesProxy = iface_cast<IStandardRecorderProfilesService>(object);
150 CHECK_AND_RETURN_RET_LOG(recorderProfilesProxy != nullptr, nullptr, "recorderProfiles proxy is nullptr.");
151
152 std::shared_ptr<RecorderProfilesClient> recorderProfiles = RecorderProfilesClient::Create(recorderProfilesProxy);
153 CHECK_AND_RETURN_RET_LOG(recorderProfiles != nullptr, nullptr, "failed to create recorderProfiles client.");
154
155 recorderProfilesClientList_.push_back(recorderProfiles);
156 return recorderProfiles;
157 }
158 #endif
159
160 #ifdef SUPPORT_TRANSCODER
CreateTransCoderService()161 std::shared_ptr<ITransCoderService> MediaClient::CreateTransCoderService()
162 {
163 std::unique_lock<std::mutex> lock(mutex_);
164 sptr<IRemoteObject> object = nullptr;
165 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_TRANSCODER, object, lock);
166 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "transCoder proxy object is nullptr.");
167
168 sptr<IStandardTransCoderService> transCoderProxy = iface_cast<IStandardTransCoderService>(object);
169 CHECK_AND_RETURN_RET_LOG(transCoderProxy != nullptr, nullptr, "transCoder proxy is nullptr.");
170
171 std::shared_ptr<TransCoderClient> transCoder = TransCoderClient::Create(transCoderProxy);
172 CHECK_AND_RETURN_RET_LOG(transCoder != nullptr, nullptr, "failed to create transCoder client.");
173
174 transCoderClientList_.push_back(transCoder);
175 return transCoder;
176 }
177
DestroyTransCoderService(std::shared_ptr<ITransCoderService> transCoder)178 int32_t MediaClient::DestroyTransCoderService(std::shared_ptr<ITransCoderService> transCoder)
179 {
180 std::lock_guard<std::mutex> lock(mutex_);
181 CHECK_AND_RETURN_RET_LOG(transCoder != nullptr, MSERR_NO_MEMORY, "input transCoder is nullptr.");
182 transCoderClientList_.remove(transCoder);
183 return MSERR_OK;
184 }
185 #endif
186
187 #ifdef SUPPORT_PLAYER
CreatePlayerService()188 std::shared_ptr<IPlayerService> MediaClient::CreatePlayerService()
189 {
190 std::unique_lock<std::mutex> lock(mutex_);
191 sptr<IRemoteObject> object = nullptr;
192 #ifdef SUPPORT_START_STOP_ON_DEMAND
193 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_PLAYER, object, lock);
194 #else
195 CHECK_AND_RETURN_RET_LOG(IsAlived(), nullptr, "media service does not exist.");
196 object = mediaProxy_->GetSubSystemAbilityWithTimeOut(
197 IStandardMediaService::MediaSystemAbility::MEDIA_PLAYER, listenerStub_->AsObject(), MAX_WAIT_TIME);
198 #endif
199 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "player proxy object is nullptr.");
200
201 sptr<IStandardPlayerService> playerProxy = iface_cast<IStandardPlayerService>(object);
202 CHECK_AND_RETURN_RET_LOG(playerProxy != nullptr, nullptr, "player proxy is nullptr.");
203
204 std::shared_ptr<PlayerClient> player = PlayerClient::Create(playerProxy);
205 CHECK_AND_RETURN_RET_LOG(player != nullptr, nullptr, "failed to create player client.");
206
207 playerClientList_.push_back(player);
208 return player;
209 }
210
DestroyPlayerService(std::shared_ptr<IPlayerService> player)211 int32_t MediaClient::DestroyPlayerService(std::shared_ptr<IPlayerService> player)
212 {
213 std::lock_guard<std::mutex> lock(mutex_);
214 CHECK_AND_RETURN_RET_LOG(player != nullptr, MSERR_NO_MEMORY, "input player is nullptr.");
215 playerClientList_.remove(player);
216 return MSERR_OK;
217 }
218 #endif
219
220 #ifdef SUPPORT_METADATA
CreateAVMetadataHelperService()221 std::shared_ptr<IAVMetadataHelperService> MediaClient::CreateAVMetadataHelperService()
222 {
223 std::unique_lock<std::mutex> lock(mutex_);
224 sptr<IRemoteObject> object = nullptr;
225 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_AVMETADATAHELPER, object, lock);
226 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "avmetadatahelper proxy object is nullptr.");
227
228 sptr<IStandardAVMetadataHelperService> avMetadataHelperProxy = iface_cast<IStandardAVMetadataHelperService>(object);
229 CHECK_AND_RETURN_RET_LOG(avMetadataHelperProxy != nullptr, nullptr, "avmetadatahelper proxy is nullptr.");
230
231 std::shared_ptr<AVMetadataHelperClient> avMetadataHelper = AVMetadataHelperClient::Create(avMetadataHelperProxy);
232 CHECK_AND_RETURN_RET_LOG(avMetadataHelper != nullptr, nullptr, "failed to create avmetadatahelper client.");
233
234 avMetadataHelperClientList_.push_back(avMetadataHelper);
235 return avMetadataHelper;
236 }
237
DestroyAVMetadataHelperService(std::shared_ptr<IAVMetadataHelperService> avMetadataHelper)238 int32_t MediaClient::DestroyAVMetadataHelperService(std::shared_ptr<IAVMetadataHelperService> avMetadataHelper)
239 {
240 std::lock_guard<std::mutex> lock(mutex_);
241 CHECK_AND_RETURN_RET_LOG(avMetadataHelper != nullptr, MSERR_NO_MEMORY,
242 "input avmetadatahelper is nullptr.");
243 avMetadataHelperClientList_.remove(avMetadataHelper);
244 return MSERR_OK;
245 }
246 #endif
247
248 #ifdef SUPPORT_SCREEN_CAPTURE
CreateScreenCaptureMonitorService()249 std::shared_ptr<IScreenCaptureMonitorService> MediaClient::CreateScreenCaptureMonitorService()
250 {
251 std::unique_lock<std::mutex> lock(mutex_);
252 sptr<IRemoteObject> object = nullptr;
253 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_SCREEN_CAPTURE_MONITOR, object, lock);
254 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "screenCaptureMonitor proxy object is nullptr.");
255
256 sptr<IStandardScreenCaptureMonitorService> screenCaptureMonitorProxy =
257 iface_cast<IStandardScreenCaptureMonitorService>(object);
258 CHECK_AND_RETURN_RET_LOG(screenCaptureMonitorProxy != nullptr, nullptr, "screenCaptureMonitor proxy is nullptr.");
259
260 std::shared_ptr<ScreenCaptureMonitorClient> screenCaptureMonitor =
261 ScreenCaptureMonitorClient::Create(screenCaptureMonitorProxy);
262 CHECK_AND_RETURN_RET_LOG(screenCaptureMonitor != nullptr, nullptr, "failed to create screenCaptureMonitor client.");
263 screenCaptureMonitorClientList_.push_back(screenCaptureMonitor);
264 return screenCaptureMonitor;
265 }
266
DestroyScreenCaptureMonitorService(std::shared_ptr<IScreenCaptureMonitorService> screenCaptureMonitor)267 int32_t MediaClient::DestroyScreenCaptureMonitorService(
268 std::shared_ptr<IScreenCaptureMonitorService> screenCaptureMonitor)
269 {
270 std::lock_guard<std::mutex> lock(mutex_);
271 CHECK_AND_RETURN_RET_LOG(screenCaptureMonitor != nullptr, MSERR_NO_MEMORY,
272 "input screenCapture is nullptr.");
273 screenCaptureMonitorClientList_.remove(screenCaptureMonitor);
274 return MSERR_OK;
275 }
276
CreateScreenCaptureService()277 std::shared_ptr<IScreenCaptureService> MediaClient::CreateScreenCaptureService()
278 {
279 std::unique_lock<std::mutex> lock(mutex_);
280 sptr<IRemoteObject> object = nullptr;
281 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_SCREEN_CAPTURE, object, lock);
282 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "screenCapture proxy object is nullptr.");
283
284 sptr<IStandardScreenCaptureService> screenCaptureProxy = iface_cast<IStandardScreenCaptureService>(object);
285 CHECK_AND_RETURN_RET_LOG(screenCaptureProxy != nullptr, nullptr, "screenCapture proxy is nullptr.");
286
287 std::shared_ptr<ScreenCaptureClient> screenCapture = ScreenCaptureClient::Create(screenCaptureProxy);
288 CHECK_AND_RETURN_RET_LOG(screenCapture != nullptr, nullptr, "failed to create screenCapture client.");
289
290 screenCaptureClientList_.push_back(screenCapture);
291 return screenCapture;
292 }
293
DestroyScreenCaptureService(std::shared_ptr<IScreenCaptureService> screenCapture)294 int32_t MediaClient::DestroyScreenCaptureService(std::shared_ptr<IScreenCaptureService> screenCapture)
295 {
296 std::lock_guard<std::mutex> lock(mutex_);
297 CHECK_AND_RETURN_RET_LOG(screenCapture != nullptr, MSERR_NO_MEMORY,
298 "input screenCapture is nullptr.");
299 screenCaptureClientList_.remove(screenCapture);
300 return MSERR_OK;
301 }
302
CreateScreenCaptureControllerClient()303 std::shared_ptr<IScreenCaptureController> MediaClient::CreateScreenCaptureControllerClient()
304 {
305 std::unique_lock<std::mutex> lock(mutex_);
306 MEDIA_LOGI("MediaClient::CreateScreenCaptureControllerClient() start");
307
308 sptr<IRemoteObject> object = nullptr;
309 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_SCREEN_CAPTURE_CONTROLLER,
310 object, lock);
311 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "screenCapture controller proxy object is nullptr.");
312
313 sptr<IStandardScreenCaptureController> controllerProxy = iface_cast<IStandardScreenCaptureController>(object);
314 CHECK_AND_RETURN_RET_LOG(controllerProxy != nullptr, nullptr, "controllerProxy is nullptr.");
315
316 std::shared_ptr<ScreenCaptureControllerClient> controller = ScreenCaptureControllerClient::Create(controllerProxy);
317 CHECK_AND_RETURN_RET_LOG(controller != nullptr, nullptr, "failed to create screenCapture controller.");
318
319 screenCaptureControllerList_.push_back(controller);
320 MEDIA_LOGI("MediaClient::CreateScreenCaptureControllerClient() end");
321 return controller;
322 }
323
DestroyScreenCaptureControllerClient(std::shared_ptr<IScreenCaptureController> controller)324 int32_t MediaClient::DestroyScreenCaptureControllerClient(std::shared_ptr<IScreenCaptureController> controller)
325 {
326 std::lock_guard<std::mutex> lock(mutex_);
327 CHECK_AND_RETURN_RET_LOG(controller != nullptr, MSERR_NO_MEMORY,
328 "input screenCapture controller is nullptr.");
329 screenCaptureControllerList_.remove(controller);
330 return MSERR_OK;
331 }
332 #endif
333
GetMonitorProxy()334 sptr<IStandardMonitorService> MediaClient::GetMonitorProxy()
335 {
336 std::unique_lock<std::mutex> lock(mutex_);
337 sptr<IRemoteObject> object = nullptr;
338 CreateMediaServiceInstance(IStandardMediaService::MediaSystemAbility::MEDIA_MONITOR, object, lock);
339 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "monitor proxy object is nullptr.");
340
341 sptr<IStandardMonitorService> monitorProxy = iface_cast<IStandardMonitorService>(object);
342 CHECK_AND_RETURN_RET_LOG(monitorProxy != nullptr, nullptr, "monitor proxy is nullptr.");
343
344 return monitorProxy;
345 }
346
GetMediaProxy()347 sptr<IStandardMediaService> MediaClient::GetMediaProxy()
348 {
349 MEDIA_LOGD("enter");
350 sptr<ISystemAbilityManager> samgr = nullptr;
351 samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
352 CHECK_AND_RETURN_RET_LOG(samgr != nullptr, nullptr, "system ability manager is nullptr.");
353 sptr<IRemoteObject> object = nullptr;
354 object = samgr->CheckSystemAbility(OHOS::PLAYER_DISTRIBUTED_SERVICE_ID);
355 if (object == nullptr) {
356 MEDIA_LOGI("SA not load");
357 object = samgr->LoadSystemAbility(OHOS::PLAYER_DISTRIBUTED_SERVICE_ID, LOAD_TIME);
358 }
359 CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "media object is nullptr.");
360
361 mediaProxy_ = iface_cast<IStandardMediaService>(object);
362 CHECK_AND_RETURN_RET_LOG(mediaProxy_ != nullptr, nullptr, "media proxy is nullptr.");
363
364 pid_t pid = 0;
365 deathRecipient_ = new(std::nothrow) MediaDeathRecipient(pid);
366 CHECK_AND_RETURN_RET_LOG(deathRecipient_ != nullptr, nullptr, "failed to new MediaDeathRecipient.");
367
368 deathRecipient_->SetNotifyCb(std::bind(&MediaClient::MediaServerDied, std::placeholders::_1));
369 bool result = object->AddDeathRecipient(deathRecipient_);
370 if (!result) {
371 MEDIA_LOGE("failed to add deathRecipient");
372 return nullptr;
373 }
374
375 listenerStub_ = new(std::nothrow) MediaListenerStub();
376 CHECK_AND_RETURN_RET_LOG(listenerStub_ != nullptr, nullptr, "failed to new MediaListenerStub");
377 return mediaProxy_;
378 }
379
MediaServerDied(pid_t pid)380 void MediaClient::MediaServerDied(pid_t pid)
381 {
382 MEDIA_LOGE("media server is died, pid:%{public}d!", pid);
383 g_mediaClientInstance.DoMediaServerDied();
384 }
385
AVPlayerServerDied()386 void MediaClient::AVPlayerServerDied()
387 {
388 #ifdef SUPPORT_PLAYER
389 for (auto &it : playerClientList_) {
390 auto player = std::static_pointer_cast<PlayerClient>(it);
391 if (player != nullptr) {
392 player->MediaServerDied();
393 }
394 }
395 #endif
396
397 #ifdef SUPPORT_METADATA
398 for (auto &it : avMetadataHelperClientList_) {
399 auto avMetadataHelper = std::static_pointer_cast<AVMetadataHelperClient>(it);
400 if (avMetadataHelper != nullptr) {
401 avMetadataHelper->MediaServerDied();
402 }
403 }
404 #endif
405 }
406
DoMediaServerDied()407 void MediaClient::DoMediaServerDied()
408 {
409 std::lock_guard<std::mutex> lock(mutex_);
410 MEDIA_LOGI("DoMediaServerDied");
411 if (mediaProxy_ != nullptr) {
412 (void)mediaProxy_->AsObject()->RemoveDeathRecipient(deathRecipient_);
413 mediaProxy_ = nullptr;
414 }
415 listenerStub_ = nullptr;
416 deathRecipient_ = nullptr;
417 std::shared_ptr<MonitorClient> monitor = MonitorClient::GetInstance();
418 CHECK_AND_RETURN_LOG(monitor != nullptr, "Failed to get monitor Instance!");
419 monitor->MediaServerDied();
420 AVPlayerServerDied();
421 #ifdef SUPPORT_RECORDER
422 for (auto &it : recorderClientList_) {
423 auto recorder = std::static_pointer_cast<RecorderClient>(it);
424 if (recorder != nullptr) {
425 recorder->MediaServerDied();
426 }
427 }
428 for (auto &it : recorderProfilesClientList_) {
429 auto recorderProfilesClient = std::static_pointer_cast<RecorderProfilesClient>(it);
430 if (recorderProfilesClient != nullptr) {
431 recorderProfilesClient->MediaServerDied();
432 }
433 }
434 #endif
435 #ifdef SUPPORT_SCREEN_CAPTURE
436 for (auto &it : screenCaptureClientList_) {
437 auto screenCaptureClient = std::static_pointer_cast<ScreenCaptureClient>(it);
438 if (screenCaptureClient != nullptr) {
439 screenCaptureClient->MediaServerDied();
440 }
441 }
442 for (auto &it : screenCaptureMonitorClientList_) {
443 auto screenCaptureMonitorClient = std::static_pointer_cast<ScreenCaptureMonitorClient>(it);
444 if (screenCaptureMonitorClient != nullptr) {
445 screenCaptureMonitorClient->MediaServerDied();
446 }
447 }
448 for (auto &it : screenCaptureControllerList_) {
449 auto screenCaptureControllerClient = std::static_pointer_cast<ScreenCaptureControllerClient>(it);
450 if (screenCaptureControllerClient != nullptr) {
451 screenCaptureControllerClient->MediaServerDied();
452 }
453 }
454 #endif
455 mediaProxyUpdatedCondition_.notify_all();
456 }
457 } // namespace Media
458 } // namespace OHOS