Changeset 223157 in webkit
- Timestamp:
- Oct 10, 2017 4:46:05 PM (7 years ago)
- Location:
- branches/safari-604-branch
- Files:
-
- 2 added
- 18 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-604-branch/LayoutTests/ChangeLog
r223107 r223157 1 2017-10-10 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r222478. rdar://problem/34771020 4 5 2017-09-25 Youenn Fablet <youenn@apple.com> 6 7 WebRTC video does not resume receiving when switching back to Safari 11 on iOS 8 https://bugs.webkit.org/show_bug.cgi?id=175472 9 <rdar://problem/33860863> 10 11 Reviewed by Darin Adler. 12 13 * webrtc/video-interruption-expected.txt: Added. 14 * webrtc/video-interruption.html: Added. 15 1 16 2017-10-09 Jason Marcell <jmarcell@apple.com> 2 17 -
branches/safari-604-branch/Source/ThirdParty/libwebrtc/ChangeLog
r219082 r223157 1 2017-10-10 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r222478. rdar://problem/34771020 4 5 2017-09-25 Youenn Fablet <youenn@apple.com> 6 7 WebRTC video does not resume receiving when switching back to Safari 11 on iOS 8 https://bugs.webkit.org/show_bug.cgi?id=175472 9 <rdar://problem/33860863> 10 11 Reviewed by Darin Adler. 12 13 Adding a method to disable any decoding/encoding task. 14 When reenabling the decoder, the decoder will request an I frame after failing the first initial decoding task. 15 16 * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h: 17 (webrtc::H264VideoToolboxDecoder::SetActive): 18 * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.mm: 19 (webrtc::H264VideoToolboxDecoder::Decode): 20 * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: 21 * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: 22 (webrtc::H264VideoToolboxEncoder::Encode): 23 1 24 2017-07-03 Andy Estes <aestes@apple.com> 2 25 -
branches/safari-604-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h
r218645 r223157 44 44 const char* ImplementationName() const override; 45 45 46 void SetActive(bool is_active) { is_active_ = is_active; } 47 46 48 private: 47 49 int ResetDecompressionSession(); … … 53 55 CMVideoFormatDescriptionRef video_format_; 54 56 VTDecompressionSessionRef decompression_session_; 57 bool is_active_ { true }; 55 58 }; // H264VideoToolboxDecoder 56 59 -
branches/safari-604-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.mm
r218645 r223157 96 96 RTC_DCHECK(input_image._buffer); 97 97 98 #if defined(WEBRTC_IOS) && !defined(WEBRTC_WEBKIT_BUILD) 98 #if defined(WEBRTC_IOS) 99 #if !defined(WEBRTC_WEBKIT_BUILD) 99 100 if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) { 101 #else 102 if (!is_active_) { 103 #endif 100 104 // Ignore all decode requests when app isn't active. In this state, the 101 105 // hardware decoder has been invalidated by the OS. -
branches/safari-604-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h
r218699 r223157 70 70 ScalingSettings GetScalingSettings() const override; 71 71 72 void SetActive(bool is_active) { is_active_ = is_active; } 73 72 74 protected: 73 75 virtual int CreateCompressionSession(VTCompressionSessionRef&, VTCompressionOutputCallback, int32_t width, int32_t height, bool useHardwareEncoder = true); … … 95 97 H264BitstreamParser h264_bitstream_parser_; 96 98 std::vector<uint8_t> nv12_scale_buffer_; 99 bool is_active_ { true }; 97 100 }; // H264VideoToolboxEncoder 98 101 -
branches/safari-604-branch/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm
r218699 r223157 385 385 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; 386 386 } 387 #if defined(WEBRTC_IOS) && !defined(WEBRTC_WEBKIT_BUILD) 388 if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) { 387 388 #if defined(WEBRTC_IOS) 389 #if !defined(WEBRTC_WEBKIT_BUILD) 390 if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) { 391 #else 392 if (!is_active_) { 393 #endif 389 394 // Ignore all encode requests when app isn't active. In this state, the 390 395 // hardware encoder has been invalidated by the OS. -
branches/safari-604-branch/Source/WebCore/ChangeLog
r223120 r223157 1 2017-10-10 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r222478. rdar://problem/34771020 4 5 2017-09-25 Youenn Fablet <youenn@apple.com> 6 7 WebRTC video does not resume receiving when switching back to Safari 11 on iOS 8 https://bugs.webkit.org/show_bug.cgi?id=175472 9 <rdar://problem/33860863> 10 11 Reviewed by Darin Adler. 12 13 Test: webrtc/video-interruption.html and manual testing. 14 15 Using new SetActive method from libwebrtc encoder/decoder to enable/disable them based on interuptions. 16 For that purpose, LibWebRTCProvider is now storing the peer connection factory and keeping track of the encoder/decoder factories. 17 LibWebRTCProvider is then notified by WebPage when backgrounded/foregrounded. 18 19 * WebCore.xcodeproj/project.pbxproj: 20 * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: 21 (WebCore::staticFactoryAndThreads): 22 (WebCore::initializePeerConnectionFactoryAndThreads): 23 (WebCore::LibWebRTCProvider::factory): 24 (WebCore::LibWebRTCProvider::setPeerConnectionFactory): 25 (WebCore::LibWebRTCProvider::createPeerConnection): 26 (WebCore::LibWebRTCProvider::setActive): 27 (WebCore::LibWebRTCProvider::webRTCAvailable): 28 (WebCore::LibWebRTCProvider::mayResumePlayback): Deleted. 29 (WebCore::LibWebRTCProvider::suspendPlayback): Deleted. 30 * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 31 * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp: Copied from Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp. 32 (WebCore::VideoToolboxVideoDecoderFactory::setActive): 33 (WebCore::VideoToolboxVideoDecoderFactory::CreateVideoDecoder): 34 (WebCore::VideoToolboxVideoDecoderFactory::DestroyVideoDecoder): 35 * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.h: Copied from Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h. 36 * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: 37 (WebCore::VideoToolboxVideoEncoderFactory::setActive): 38 (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder): 39 (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder): 40 * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h: 41 * testing/Internals.cpp: 42 (WebCore::Internals::resetToConsistentState): 43 * testing/MockLibWebRTCPeerConnection.cpp: 44 (WebCore::useRealRTCPeerConnectionFactory): 45 (WebCore::useMockRTCPeerConnectionFactory): 46 * testing/MockLibWebRTCPeerConnection.h: 47 1 48 2017-10-09 Jason Marcell <jmarcell@apple.com> 2 49 -
branches/safari-604-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r220749 r223157 1799 1799 41D015CA0F4B5C71004A662F /* ContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D015C80F4B5C71004A662F /* ContentType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1800 1800 41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D015C90F4B5C71004A662F /* ContentType.cpp */; }; 1801 41D7E5571F73085500E26991 /* VideoToolBoxDecoderFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D7E5551F73085000E26991 /* VideoToolBoxDecoderFactory.cpp */; }; 1801 1802 41DEFCB51E56C1BD000D9E5F /* JSDOMMapLike.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DEFCB31E56C1B9000D9E5F /* JSDOMMapLike.cpp */; }; 1802 1803 41DEFCB61E56C1BD000D9E5F /* JSDOMMapLike.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DEFCB41E56C1B9000D9E5F /* JSDOMMapLike.h */; }; … … 9468 9469 41D015C90F4B5C71004A662F /* ContentType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentType.cpp; sourceTree = "<group>"; }; 9469 9470 41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCAudioFormat.h; path = libwebrtc/LibWebRTCAudioFormat.h; sourceTree = "<group>"; }; 9471 41D7E5541F73085000E26991 /* VideoToolBoxDecoderFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoToolBoxDecoderFactory.h; path = libwebrtc/VideoToolBoxDecoderFactory.h; sourceTree = "<group>"; }; 9472 41D7E5551F73085000E26991 /* VideoToolBoxDecoderFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoToolBoxDecoderFactory.cpp; path = libwebrtc/VideoToolBoxDecoderFactory.cpp; sourceTree = "<group>"; }; 9470 9473 41DEFCB21E56C1B9000D9E5F /* JSDOMBindingInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = JSDOMBindingInternals.js; sourceTree = "<group>"; }; 9471 9474 41DEFCB31E56C1B9000D9E5F /* JSDOMMapLike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMapLike.cpp; sourceTree = "<group>"; }; … … 17663 17666 41A1B00D1E52656E007F3769 /* LibWebRTCProvider.cpp */, 17664 17667 415747441E38699E00E914D8 /* LibWebRTCProvider.h */, 17668 41D7E5551F73085000E26991 /* VideoToolBoxDecoderFactory.cpp */, 17669 41D7E5541F73085000E26991 /* VideoToolBoxDecoderFactory.h */, 17665 17670 41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */, 17666 17671 41CAD71D1EA0905700178164 /* VideoToolBoxEncoderFactory.h */, … … 33697 33702 CDE83DB1183C44060031EAA3 /* VideoPlaybackQuality.cpp in Sources */, 33698 33703 CD9D82791C7B8EE1006FF066 /* VideoTextureCopierCV.cpp in Sources */, 33704 41D7E5571F73085500E26991 /* VideoToolBoxDecoderFactory.cpp in Sources */, 33699 33705 41CAD71E1EA090A100178164 /* VideoToolBoxEncoderFactory.cpp in Sources */, 33700 33706 CDC939A71E9BDFB100BB768D /* VideoToolboxSoftLink.cpp in Sources */, -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
r218994 r223157 30 30 #include "LibWebRTCAudioModule.h" 31 31 #include "Logging.h" 32 #include "VideoToolBoxDecoderFactory.h" 32 33 #include "VideoToolBoxEncoderFactory.h" 33 34 #include <dlfcn.h> … … 36 37 #include <webrtc/p2p/client/basicportallocator.h> 37 38 #include <webrtc/pc/peerconnectionfactory.h> 38 #include <webrtc/sdk/objc/Framework/Classes/VideoToolbox/videocodecfactory.h>39 39 #include <wtf/Function.h> 40 40 #include <wtf/NeverDestroyed.h> … … 46 46 #if USE(LIBWEBRTC) 47 47 struct PeerConnectionFactoryAndThreads : public rtc::MessageHandler { 48 std::unique_ptr<LibWebRTCAudioModule> audioDeviceModule;49 48 std::unique_ptr<rtc::Thread> networkThread; 50 49 std::unique_ptr<rtc::Thread> signalingThread; 51 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory;52 50 bool networkThreadWithSocketServer { false }; 53 Function<std::unique_ptr<cricket::WebRtcVideoEncoderFactory>()> encoderFactoryGetter; 54 Function<std::unique_ptr<cricket::WebRtcVideoDecoderFactory>()> decoderFactoryGetter; 51 std::unique_ptr<LibWebRTCAudioModule> audioDeviceModule; 55 52 56 53 private: … … 58 55 }; 59 56 57 static void initializePeerConnectionFactoryAndThreads(PeerConnectionFactoryAndThreads& factoryAndThreads) 58 { 59 ASSERT(!factoryAndThreads.networkThread); 60 61 #if defined(NDEBUG) 62 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED 63 rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_NONE : rtc::LS_INFO); 64 #else 65 rtc::LogMessage::LogToDebug(rtc::LS_NONE); 66 #endif 67 #else 68 rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_WARNING : rtc::LS_INFO); 69 #endif 70 71 factoryAndThreads.networkThread = factoryAndThreads.networkThreadWithSocketServer ? rtc::Thread::CreateWithSocketServer() : rtc::Thread::Create(); 72 factoryAndThreads.networkThread->SetName("WebKitWebRTCNetwork", nullptr); 73 bool result = factoryAndThreads.networkThread->Start(); 74 ASSERT_UNUSED(result, result); 75 76 factoryAndThreads.signalingThread = rtc::Thread::Create(); 77 factoryAndThreads.signalingThread->SetName("WebKitWebRTCSignaling", nullptr); 78 79 result = factoryAndThreads.signalingThread->Start(); 80 ASSERT(result); 81 82 factoryAndThreads.audioDeviceModule = std::make_unique<LibWebRTCAudioModule>(); 83 } 84 60 85 static inline PeerConnectionFactoryAndThreads& staticFactoryAndThreads() 61 86 { 62 87 static NeverDestroyed<PeerConnectionFactoryAndThreads> factoryAndThreads; 63 #if PLATFORM(COCOA)64 static std::once_flag once;65 std::call_once(once, [] {66 factoryAndThreads.get().encoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoEncoderFactory> { return std::make_unique<VideoToolboxVideoEncoderFactory>(); };67 factoryAndThreads.get().decoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoDecoderFactory> { return std::make_unique<webrtc::VideoToolboxVideoDecoderFactory>(); };68 });69 #endif70 88 return factoryAndThreads.get(); 89 } 90 91 static inline PeerConnectionFactoryAndThreads& getStaticFactoryAndThreads(bool useNetworkThreadWithSocketServer) 92 { 93 auto& factoryAndThreads = staticFactoryAndThreads(); 94 95 ASSERT(!factoryAndThreads.networkThread || factoryAndThreads.networkThreadWithSocketServer == useNetworkThreadWithSocketServer); 96 97 if (!factoryAndThreads.networkThread) { 98 factoryAndThreads.networkThreadWithSocketServer = useNetworkThreadWithSocketServer; 99 initializePeerConnectionFactoryAndThreads(factoryAndThreads); 100 } 101 return factoryAndThreads; 71 102 } 72 103 … … 98 129 } 99 130 100 static void initializePeerConnectionFactoryAndThreads()101 {102 #if defined(NDEBUG)103 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED104 rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_NONE : rtc::LS_INFO);105 #else106 rtc::LogMessage::LogToDebug(rtc::LS_NONE);107 #endif108 #else109 rtc::LogMessage::LogToDebug(LogWebRTC.state != WTFLogChannelOn ? rtc::LS_WARNING : rtc::LS_INFO);110 #endif111 auto& factoryAndThreads = staticFactoryAndThreads();112 113 ASSERT(!factoryAndThreads.factory);114 115 factoryAndThreads.networkThread = factoryAndThreads.networkThreadWithSocketServer ? rtc::Thread::CreateWithSocketServer() : rtc::Thread::Create();116 factoryAndThreads.networkThread->SetName("WebKitWebRTCNetwork", nullptr);117 bool result = factoryAndThreads.networkThread->Start();118 ASSERT_UNUSED(result, result);119 120 factoryAndThreads.signalingThread = rtc::Thread::Create();121 factoryAndThreads.signalingThread->SetName("WebKitWebRTCSignaling", nullptr);122 123 result = factoryAndThreads.signalingThread->Start();124 ASSERT(result);125 126 factoryAndThreads.audioDeviceModule = std::make_unique<LibWebRTCAudioModule>();127 128 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoderFactory = factoryAndThreads.encoderFactoryGetter ? factoryAndThreads.encoderFactoryGetter() : nullptr;129 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoderFactory = factoryAndThreads.decoderFactoryGetter ? factoryAndThreads.decoderFactoryGetter() : nullptr;130 131 factoryAndThreads.factory = webrtc::CreatePeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.signalingThread.get(), factoryAndThreads.audioDeviceModule.get(), encoderFactory.release(), decoderFactory.release());132 133 ASSERT(factoryAndThreads.factory);134 }135 136 131 webrtc::PeerConnectionFactoryInterface* LibWebRTCProvider::factory() 137 132 { 133 if (m_factory) 134 return m_factory.get(); 135 138 136 if (!webRTCAvailable()) 139 137 return nullptr; 140 if (!staticFactoryAndThreads().factory) { 141 staticFactoryAndThreads().networkThreadWithSocketServer = m_useNetworkThreadWithSocketServer; 142 initializePeerConnectionFactoryAndThreads(); 143 } 144 return staticFactoryAndThreads().factory; 145 } 146 147 void LibWebRTCProvider::setDecoderFactoryGetter(Function<std::unique_ptr<cricket::WebRtcVideoDecoderFactory>()>&& getter) 148 { 149 if (!staticFactoryAndThreads().factory) 150 initializePeerConnectionFactoryAndThreads(); 151 152 staticFactoryAndThreads().decoderFactoryGetter = WTFMove(getter); 153 } 154 155 void LibWebRTCProvider::setEncoderFactoryGetter(Function<std::unique_ptr<cricket::WebRtcVideoEncoderFactory>()>&& getter) 156 { 157 if (!staticFactoryAndThreads().factory) 158 initializePeerConnectionFactoryAndThreads(); 159 160 staticFactoryAndThreads().encoderFactoryGetter = WTFMove(getter); 138 139 auto& factoryAndThreads = getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer); 140 141 auto decoderFactory = std::make_unique<VideoToolboxVideoDecoderFactory>(); 142 auto encoderFactory = std::make_unique<VideoToolboxVideoEncoderFactory>(); 143 144 m_decoderFactory = decoderFactory.get(); 145 m_encoderFactory = encoderFactory.get(); 146 147 m_factory = webrtc::CreatePeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.signalingThread.get(), factoryAndThreads.audioDeviceModule.get(), encoderFactory.release(), decoderFactory.release()); 148 149 return m_factory; 161 150 } 162 151 163 152 void LibWebRTCProvider::setPeerConnectionFactory(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>&& factory) 164 153 { 165 if (!staticFactoryAndThreads().factory) 166 initializePeerConnectionFactoryAndThreads(); 167 168 staticFactoryAndThreads().factory = webrtc::PeerConnectionFactoryProxy::Create(staticFactoryAndThreads().signalingThread.get(), WTFMove(factory)); 169 } 170 171 static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createActualPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration) 172 { 173 ASSERT(staticFactoryAndThreads().factory); 174 175 return staticFactoryAndThreads().factory->CreatePeerConnection(configuration, WTFMove(portAllocator), nullptr, &observer); 154 m_factory = webrtc::PeerConnectionFactoryProxy::Create(getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer).signalingThread.get(), WTFMove(factory)); 176 155 } 177 156 … … 179 158 { 180 159 // Default WK1 implementation. 181 auto& factoryAndThreads = staticFactoryAndThreads(); 182 if (!factoryAndThreads.factory) { 183 staticFactoryAndThreads().networkThreadWithSocketServer = true; 184 initializePeerConnectionFactoryAndThreads(); 185 } 186 ASSERT(staticFactoryAndThreads().networkThreadWithSocketServer); 187 188 return createActualPeerConnection(observer, nullptr, WTFMove(configuration)); 160 ASSERT(m_useNetworkThreadWithSocketServer); 161 auto* factory = this->factory(); 162 if (!factory) 163 return nullptr; 164 165 return m_factory->CreatePeerConnection(configuration, nullptr, nullptr, &observer); 189 166 } 190 167 191 168 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration) 192 169 { 193 ASSERT(!staticFactoryAndThreads().networkThreadWithSocketServer); 194 195 auto& factoryAndThreads = staticFactoryAndThreads(); 196 if (!factoryAndThreads.factory) 197 initializePeerConnectionFactoryAndThreads(); 170 ASSERT(!m_useNetworkThreadWithSocketServer); 171 172 auto& factoryAndThreads = getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer); 198 173 199 174 std::unique_ptr<cricket::BasicPortAllocator> portAllocator; 200 staticFactoryAndThreads().signalingThread->Invoke<void>(RTC_FROM_HERE, [&]() {175 factoryAndThreads.signalingThread->Invoke<void>(RTC_FROM_HERE, [&]() { 201 176 auto basicPortAllocator = std::make_unique<cricket::BasicPortAllocator>(&networkManager, &packetSocketFactory); 202 177 if (!m_enableEnumeratingAllNetworkInterfaces) … … 205 180 }); 206 181 207 return createActualPeerConnection(observer, WTFMove(portAllocator), WTFMove(configuration)); 182 auto* factory = this->factory(); 183 if (!factory) 184 return nullptr; 185 186 return m_factory->CreatePeerConnection(configuration, WTFMove(portAllocator), nullptr, &observer); 208 187 } 209 188 210 189 #endif // USE(LIBWEBRTC) 211 190 191 void LibWebRTCProvider::setActive(bool value) 192 { 193 #if USE(LIBWEBRTC) 194 if (m_decoderFactory) 195 m_decoderFactory->setActive(value); 196 if (m_encoderFactory) 197 m_encoderFactory->setActive(value); 198 #else 199 UNUSED_PARAM(value); 200 #endif 201 } 202 212 203 bool LibWebRTCProvider::webRTCAvailable() 213 204 { -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
r218994 r223157 46 46 namespace WebCore { 47 47 48 class VideoToolboxVideoDecoderFactory; 49 class VideoToolboxVideoEncoderFactory; 50 48 51 class WEBCORE_EXPORT LibWebRTCProvider { 49 52 public: … … 52 55 53 56 static bool webRTCAvailable(); 57 58 void setActive(bool); 59 54 60 #if USE(LIBWEBRTC) 55 61 WEBCORE_EXPORT virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, webrtc::PeerConnectionInterface::RTCConfiguration&&); … … 60 66 static WEBCORE_EXPORT void callOnWebRTCNetworkThread(Function<void()>&&); 61 67 static WEBCORE_EXPORT void callOnWebRTCSignalingThread(Function<void()>&&); 62 static WEBCORE_EXPORT void setDecoderFactoryGetter(Function<std::unique_ptr<cricket::WebRtcVideoDecoderFactory>()>&&);63 static WEBCORE_EXPORT void setEncoderFactoryGetter(Function<std::unique_ptr<cricket::WebRtcVideoEncoderFactory>()>&&);64 68 65 69 // Used for mock testing 66 staticvoid setPeerConnectionFactory(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>&&);70 void setPeerConnectionFactory(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>&&); 67 71 68 72 void disableEnumeratingAllNetworkInterfaces() { m_enableEnumeratingAllNetworkInterfaces = false; } … … 73 77 74 78 bool m_enableEnumeratingAllNetworkInterfaces { false }; 79 // FIXME: Remove m_useNetworkThreadWithSocketServer member variable and make it a global. 75 80 bool m_useNetworkThreadWithSocketServer { true }; 81 82 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> m_factory; 83 VideoToolboxVideoDecoderFactory* m_decoderFactory { nullptr }; 84 VideoToolboxVideoEncoderFactory* m_encoderFactory { nullptr }; 76 85 #endif 77 86 }; -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp
r223120 r223157 25 25 26 26 #include "config.h" 27 #include "VideoToolBox EncoderFactory.h"27 #include "VideoToolBoxDecoderFactory.h" 28 28 29 29 #if USE(LIBWEBRTC) && PLATFORM(COCOA) 30 30 31 #include "H264VideoToolBoxEncoder.h"32 33 31 namespace WebCore { 34 32 35 webrtc::VideoEncoder* VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder(const cricket::VideoCodec& codec)33 void VideoToolboxVideoDecoderFactory::setActive(bool isActive) 36 34 { 37 return new H264VideoToolboxEncoder(codec); 35 if (m_isActive == isActive) 36 return; 37 38 m_isActive = isActive; 39 for (webrtc::H264VideoToolboxDecoder& decoder : m_decoders) 40 decoder.SetActive(isActive); 38 41 } 39 42 40 void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder(webrtc::VideoEncoder* encoder)43 webrtc::VideoDecoder* VideoToolboxVideoDecoderFactory::CreateVideoDecoder(webrtc::VideoCodecType type) 41 44 { 42 delete encoder; 43 encoder = nullptr; 45 auto* decoder = webrtc::VideoToolboxVideoDecoderFactory::CreateVideoDecoder(type); 46 if (decoder) 47 m_decoders.append(static_cast<webrtc::H264VideoToolboxDecoder&>(*decoder)); 48 49 return decoder; 50 } 51 52 void VideoToolboxVideoDecoderFactory::DestroyVideoDecoder(webrtc::VideoDecoder* decoder) 53 { 54 m_decoders.removeFirstMatching([&] (const auto& item) { 55 return &item.get() == decoder; 56 }); 57 webrtc::VideoToolboxVideoDecoderFactory::DestroyVideoDecoder(decoder); 44 58 } 45 59 -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.h
r223120 r223157 29 29 30 30 #include "LibWebRTCMacros.h" 31 #include <webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h> 31 32 #include <webrtc/sdk/objc/Framework/Classes/VideoToolbox/videocodecfactory.h> 33 #include <wtf/Vector.h> 32 34 33 35 namespace WebCore { 34 36 35 class VideoToolboxVideo EncoderFactory final : public webrtc::VideoToolboxVideoEncoderFactory {37 class VideoToolboxVideoDecoderFactory final : public webrtc::VideoToolboxVideoDecoderFactory { 36 38 public: 37 VideoToolboxVideoEncoderFactory() = default; 39 VideoToolboxVideoDecoderFactory() = default; 40 41 void setActive(bool isActive); 38 42 39 43 private: 40 webrtc::VideoEncoder* CreateSupportedVideoEncoder(const cricket::VideoCodec&) final; 41 void DestroyVideoEncoder(webrtc::VideoEncoder*) final; 44 webrtc::VideoDecoder* CreateVideoDecoder(webrtc::VideoCodecType) final; 45 void DestroyVideoDecoder(webrtc::VideoDecoder*) final; 46 47 Vector<std::reference_wrapper<webrtc::H264VideoToolboxDecoder>> m_decoders; 48 bool m_isActive { true }; 42 49 }; 43 50 -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp
r215548 r223157 33 33 namespace WebCore { 34 34 35 void VideoToolboxVideoEncoderFactory::setActive(bool isActive) 36 { 37 if (m_isActive == isActive) 38 return; 39 40 m_isActive = isActive; 41 for (H264VideoToolboxEncoder& encoder : m_encoders) 42 encoder.SetActive(isActive); 43 } 44 35 45 webrtc::VideoEncoder* VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder(const cricket::VideoCodec& codec) 36 46 { 37 return new H264VideoToolboxEncoder(codec); 47 auto* encoder = new H264VideoToolboxEncoder(codec); 48 m_encoders.append(*encoder); 49 50 return encoder; 38 51 } 39 52 40 53 void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder(webrtc::VideoEncoder* encoder) 41 54 { 55 m_encoders.removeFirstMatching([&] (const auto& item) { 56 return &item.get() == encoder; 57 }); 58 42 59 delete encoder; 43 encoder = nullptr;44 60 } 45 61 -
branches/safari-604-branch/Source/WebCore/platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h
r218645 r223157 30 30 #include "LibWebRTCMacros.h" 31 31 #include <webrtc/sdk/objc/Framework/Classes/VideoToolbox/videocodecfactory.h> 32 #include <wtf/Vector.h> 32 33 33 34 namespace WebCore { 35 36 class H264VideoToolboxEncoder; 34 37 35 38 class VideoToolboxVideoEncoderFactory final : public webrtc::VideoToolboxVideoEncoderFactory { … … 37 40 VideoToolboxVideoEncoderFactory() = default; 38 41 42 void setActive(bool isActive); 43 39 44 private: 40 45 webrtc::VideoEncoder* CreateSupportedVideoEncoder(const cricket::VideoCodec&) final; 41 46 void DestroyVideoEncoder(webrtc::VideoEncoder*) final; 47 48 Vector<std::reference_wrapper<H264VideoToolboxEncoder>> m_encoders; 49 bool m_isActive { true }; 42 50 }; 43 51 -
branches/safari-604-branch/Source/WebCore/testing/Internals.cpp
r223094 r223157 466 466 467 467 #if USE(LIBWEBRTC) 468 WebCore::useRealRTCPeerConnectionFactory( );468 WebCore::useRealRTCPeerConnectionFactory(page.libWebRTCProvider()); 469 469 #endif 470 470 -
branches/safari-604-branch/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp
r218795 r223157 48 48 } 49 49 50 void useRealRTCPeerConnectionFactory( )50 void useRealRTCPeerConnectionFactory(LibWebRTCProvider& provider) 51 51 { 52 52 auto& factory = getRealPeerConnectionFactory(); 53 53 if (!factory) 54 54 return; 55 LibWebRTCProvider::setPeerConnectionFactory(factory.get());55 provider.setPeerConnectionFactory(factory.get()); 56 56 factory = nullptr; 57 57 } … … 59 59 void useMockRTCPeerConnectionFactory(LibWebRTCProvider* provider, const String& testCase) 60 60 { 61 if (provider && !realPeerConnectionFactory()) { 61 if (!provider) 62 return; 63 64 if (!realPeerConnectionFactory()) { 62 65 auto& factory = getRealPeerConnectionFactory(); 63 66 factory = provider->factory(); 64 67 } 65 66 LibWebRTCProvider::setPeerConnectionFactory(MockLibWebRTCPeerConnectionFactory::create(String(testCase))); 68 provider->setPeerConnectionFactory(MockLibWebRTCPeerConnectionFactory::create(String(testCase))); 67 69 } 68 70 -
branches/safari-604-branch/Source/WebCore/testing/MockLibWebRTCPeerConnection.h
r218795 r223157 38 38 39 39 void useMockRTCPeerConnectionFactory(LibWebRTCProvider*, const String&); 40 void useRealRTCPeerConnectionFactory( );40 void useRealRTCPeerConnectionFactory(LibWebRTCProvider&); 41 41 42 42 class MockLibWebRTCPeerConnection : public webrtc::PeerConnectionInterface { -
branches/safari-604-branch/Source/WebKit/ChangeLog
r223106 r223157 1 2017-10-10 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r222478. rdar://problem/34771020 4 5 2017-09-25 Youenn Fablet <youenn@apple.com> 6 7 WebRTC video does not resume receiving when switching back to Safari 11 on iOS 8 https://bugs.webkit.org/show_bug.cgi?id=175472 9 <rdar://problem/33860863> 10 11 Reviewed by Darin Adler. 12 13 Notifying LibWebRTC of backgrounding/foregrouding. 14 15 * WebProcess/WebPage/ios/WebPageIOS.mm: 16 (WebKit::WebPage::applicationDidEnterBackground): 17 (WebKit::WebPage::applicationWillEnterForeground): 18 1 19 2017-10-09 Jason Marcell <jmarcell@apple.com> 2 20 -
branches/safari-604-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r219934 r223157 87 87 #import <WebCore/HitTestResult.h> 88 88 #import <WebCore/KeyboardEvent.h> 89 #import <WebCore/LibWebRTCProvider.h> 89 90 #import <WebCore/MainFrame.h> 90 91 #import <WebCore/MediaSessionManagerIOS.h> … … 3123 3124 m_isSuspendedUnderLock = isSuspendedUnderLock; 3124 3125 setLayerTreeStateIsFrozen(true); 3126 3127 m_page->libWebRTCProvider().setActive(false); 3125 3128 } 3126 3129 … … 3137 3140 3138 3141 [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationWillEnterForegroundNotification object:nil userInfo:@{@"isSuspendedUnderLock": @(isSuspendedUnderLock)}]; 3142 3143 m_page->libWebRTCProvider().setActive(true); 3139 3144 } 3140 3145 -
branches/safari-604-branch/WebKit.xcworkspace/xcshareddata/xcschemes/All Source.xcscheme
r219487 r223157 156 156 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 157 157 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 158 language = "" 158 159 shouldUseLaunchSchemeArgsEnv = "YES"> 159 160 <Testables> … … 175 176 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 176 177 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 178 language = "" 177 179 launchStyle = "0" 178 180 useCustomWorkingDirectory = "NO"
Note: See TracChangeset
for help on using the changeset viewer.