⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 295176 in webkit


Ignore:
Timestamp:
Jun 2, 2022, 11:45:08 PM (4 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/88904160

Location:
branches/safari-613-branch/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613-branch/Source/WebKit/ChangeLog

    r295174 r295176  
     12022-04-22  Kimmo Kinnunen  <kkinnunen@apple.com>
     2
     3        Multiple concurrency violations in LibWebRTCCodecsProxy
     4        https://bugs.webkit.org/show_bug.cgi?id=236767
     5        <rdar://88904160>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        - ThreadMessageReceivers should not add IPC listeners in constructors,
     10        as the delivery starts right away and uses the unconstructed virtual pointer.
     11        - The work queue functions should not use GPUConnectionToWebProcess, as that is
     12        main thread object.
     13        - Locked m_encoders, m_decoders are sometimes accessed without lock.
     14
     15        Instead:
     16        - Add the IPC listeners in initialize function.
     17        - Remove the IPC listeners when GPUConnectionToWebProcess disconnects.
     18        - Store the thread-safe conection, video frame object heap, process identity
     19        objects as member variables.
     20        - Do not lock m_encoders, m_decoders. If they are work queue instances,
     21        just access them in the work queue functions. Add thread requirements
     22        to the variables so that the compiler checks the access.
     23        - Use IPC testing assertions when skipping incorrect messages.
     24        - Use separate atomic counter (bool) to check if allowsExitUnderMemoryPressure.
     25
     26        No new tests, tested with existing tests and ASAN.
     27
     28        * GPUProcess/GPUConnectionToWebProcess.cpp:
     29        (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess):
     30        (WebKit::GPUConnectionToWebProcess::didClose):
     31        * GPUProcess/GPUConnectionToWebProcess.h:
     32        * GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
     33        * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
     34        (WebKit::LibWebRTCCodecsProxy::create):
     35        (WebKit::LibWebRTCCodecsProxy::LibWebRTCCodecsProxy):
     36        (WebKit::LibWebRTCCodecsProxy::stopListeningForIPC):
     37        (WebKit::LibWebRTCCodecsProxy::initialize):
     38        (WebKit::LibWebRTCCodecsProxy::dispatchToThread):
     39        (WebKit::LibWebRTCCodecsProxy::createDecoderCallback):
     40        (WebKit::LibWebRTCCodecsProxy::createH264Decoder):
     41        (WebKit::LibWebRTCCodecsProxy::createH265Decoder):
     42        (WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
     43        (WebKit::LibWebRTCCodecsProxy::releaseDecoder):
     44        (WebKit::LibWebRTCCodecsProxy::createEncoder):
     45        (WebKit::LibWebRTCCodecsProxy::releaseEncoder):
     46        (WebKit::LibWebRTCCodecsProxy::initializeEncoder):
     47        (WebKit::LibWebRTCCodecsProxy::findEncoder):
     48        (WebKit::LibWebRTCCodecsProxy::encodeFrame):
     49        (WebKit::LibWebRTCCodecsProxy::setEncodeRates):
     50        (WebKit::LibWebRTCCodecsProxy::setSharedVideoFrameSemaphore):
     51        (WebKit::LibWebRTCCodecsProxy::setSharedVideoFrameMemory):
     52        (WebKit::LibWebRTCCodecsProxy::allowsExitUnderMemoryPressure const):
     53
    1542022-04-22  Kimmo Kinnunen  <kkinnunen@apple.com>
    255
  • branches/safari-613-branch/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp

    r295172 r295176  
    253253void RemoteGraphicsContextGL::copyTextureFromMedia(WebCore::MediaPlayerIdentifier mediaPlayerIdentifier, uint32_t texture, uint32_t target, int32_t level, uint32_t internalFormat, uint32_t format, uint32_t type, bool premultiplyAlpha, bool flipY, CompletionHandler<void(bool)>&& completionHandler)
    254254{
    255     assertIsCurrent(m_workQueue());
     255    assertIsCurrent(workQueue());
    256256#if USE(AVFOUNDATION)
    257257    UNUSED_VARIABLE(premultiplyAlpha);
  • branches/safari-613-branch/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.h

    r295173 r295176  
    3232#include "RTCDecoderIdentifier.h"
    3333#include "RTCEncoderIdentifier.h"
     34#include <WebCore/ProcessIdentity.h>
    3435#include <atomic>
    3536#include <wtf/ThreadAssertions.h>
    … …  
    8889    CFDictionaryRef ioSurfacePixelBufferCreationOptions(IOSurfaceRef);
    8990
     91    Ref<IPC::Connection> m_connection;
     92    Ref<WorkQueue> m_queue;
     93    const WebCore::ProcessIdentity m_resourceOwner;
    9094
    91     Ref<WorkQueue> m_queue;
    9295    HashMap<RTCDecoderIdentifier, webrtc::LocalDecoder> m_decoders WTF_GUARDED_BY_LOCK(workQueue());
    9396    HashMap<RTCEncoderIdentifier, webrtc::LocalEncoder> m_encoders WTF_GUARDED_BY_LOCK(workQueue());
  • branches/safari-613-branch/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm

    r295173 r295176  
    3838#import <WebCore/LibWebRTCProvider.h>
    3939#import <WebCore/RemoteVideoSample.h>
     40#import <WebCore/MediaSampleAVFObjC.h>
    4041#import <webrtc/sdk/WebKit/WebKitDecoder.h>
    4142#import <webrtc/sdk/WebKit/WebKitEncoder.h>
Note: See TracChangeset for help on using the changeset viewer.