diff --git a/media/audio/ohos/ohos_audio_output_stream.cc b/media/audio/ohos/ohos_audio_output_stream.cc index b9343f064028919489077659949c04e7334f4b60..3b5ed270fde2923b171f19bf6c0cb3aafb20034c 100644 --- a/media/audio/ohos/ohos_audio_output_stream.cc +++ b/media/audio/ohos/ohos_audio_output_stream.cc @@ -262,9 +262,7 @@ void OHOSAudioOutputStream::Start(AudioSourceCallback* callback) { auto it = WEBCONTENT_SET.begin(); while (it != WEBCONTENT_SET.end()) { - auto otherWeakMediaSession = content::MediaSessionImpl::Get(*it) - ->weakMediaSessionFactory_.GetWeakPtr(); - auto otherMediaSession = otherWeakMediaSession.get(); + auto otherMediaSession = content::MediaSessionImpl::FromWebContents(*it); if (!otherMediaSession) { it = WEBCONTENT_SET.erase(it); continue; @@ -278,7 +276,7 @@ void OHOSAudioOutputStream::Start(AudioSourceCallback* callback) { LOG(INFO) << "MediaSession is suspending the audio in other web."; main_task_runner_->PostTask( FROM_HERE, - base::BindOnce(&content::MediaSessionImpl::Suspend, otherWeakMediaSession, + base::BindOnce(&content::MediaSessionImpl::Suspend, otherMediaSession->weakMediaSessionFactory_.GetWeakPtr(), content::MediaSession::SuspendType::kSystem)); } it++;