Title: [275525] trunk/Source/WebKit
- Revision
- 275525
- Author
- [email protected]
- Date
- 2021-04-06 09:36:51 -0700 (Tue, 06 Apr 2021)
Log Message
Release WebRTC remote encoder/decoder callback lock right after having changed the encoder/decoder callback
https://bugs.webkit.org/show_bug.cgi?id=224228
<rdar://74560516>
Reviewed by Eric Carlson.
We were locking the callback lock, changing the callback and hopping to codec map thread to free the encoder/decoder.
Then we were unlocking the callback lock.
There was a chance that the encoder/decoder gets freed in the codec map thread before we unlock its callback lock.
Given that we nullify the callback in decoder/encoder Release before going to destructor, we can just remove the lock/nullify code.
Covered by existing test sets.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::releaseDecoder):
(WebKit::LibWebRTCCodecs::releaseEncoder):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (275524 => 275525)
--- trunk/Source/WebKit/ChangeLog 2021-04-06 16:17:07 UTC (rev 275524)
+++ trunk/Source/WebKit/ChangeLog 2021-04-06 16:36:51 UTC (rev 275525)
@@ -1,3 +1,21 @@
+2021-04-06 Youenn Fablet <[email protected]>
+
+ Release WebRTC remote encoder/decoder callback lock right after having changed the encoder/decoder callback
+ https://bugs.webkit.org/show_bug.cgi?id=224228
+ <rdar://74560516>
+
+ Reviewed by Eric Carlson.
+
+ We were locking the callback lock, changing the callback and hopping to codec map thread to free the encoder/decoder.
+ Then we were unlocking the callback lock.
+ There was a chance that the encoder/decoder gets freed in the codec map thread before we unlock its callback lock.
+ Given that we nullify the callback in decoder/encoder Release before going to destructor, we can just remove the lock/nullify code.
+ Covered by existing test sets.
+
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+ (WebKit::LibWebRTCCodecs::releaseDecoder):
+ (WebKit::LibWebRTCCodecs::releaseEncoder):
+
2021-04-06 Alex Christensen <[email protected]>
Remove definition used for staging change with internal repo
Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp (275524 => 275525)
--- trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-04-06 16:17:07 UTC (rev 275524)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-04-06 16:36:51 UTC (rev 275525)
@@ -225,9 +225,7 @@
int32_t LibWebRTCCodecs::releaseDecoder(Decoder& decoder)
{
- LockHolder holder(decoder.decodedImageCallbackLock);
- decoder.decodedImageCallback = nullptr;
-
+ ASSERT(!decoder.decodedImageCallback);
dispatchToThread([this, decoderIdentifier = decoder.identifier] {
ASSERT(m_decoders.contains(decoderIdentifier));
if (auto decoder = m_decoders.take(decoderIdentifier))
@@ -348,9 +346,7 @@
int32_t LibWebRTCCodecs::releaseEncoder(Encoder& encoder)
{
- LockHolder holder(encoder.encodedImageCallbackLock);
- encoder.encodedImageCallback = nullptr;
-
+ ASSERT(!encoder.encodedImageCallback);
dispatchToThread([this, encoderIdentifier = encoder.identifier] {
ASSERT(m_encoders.contains(encoderIdentifier));
auto encoder = m_encoders.take(encoderIdentifier);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes