Changeset 265095 in webkit
- Timestamp:
- Jul 30, 2020 2:28:38 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/ChangeLog
r264839 r265095 1 2020-07-30 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting. 4 https://bugs.webkit.org/show_bug.cgi?id=214807 5 6 Reviewed by Darin Adler. 7 8 Look up the UTI type of the specified file, and create the appropriate SourceBufferParser 9 by passing in the ContentType (converted from UTI). Also, add a --rate-limit flag which 10 causes the decompression session to run at the same FPS as the underlying media. 11 12 * DecoderTest/DecoderTest.xcodeproj/project.pbxproj: 13 * DecoderTest/DecoderTest/main.mm: 14 (main): 15 1 16 2020-07-24 Jer Noble <jer.noble@apple.com> 2 17 -
trunk/PerformanceTests/DecoderTest/DecoderTest.xcodeproj/project.pbxproj
r264839 r265095 8 8 9 9 /* Begin PBXBuildFile section */ 10 CD89724C24CA485100AF6621 /* libwebrtc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CD89724B24CA485100AF6621 /* libwebrtc.dylib */; };11 CDE0C9BF24CA247A00593A83 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDE0C9BE24CA247A00593A83 /* JavaScriptCore.framework */; };12 10 CDE0C9C124CA249A00593A83 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDE0C9C024CA249A00593A83 /* WebKit.framework */; }; 13 11 CDE0C9C424CA36CD00593A83 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDE0C9C324CA36CD00593A83 /* CoreMedia.framework */; }; 12 CDEB7B2924CB558C0015249E /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDEB7B2824CB558C0015249E /* CoreServices.framework */; }; 13 CDEB7B2B24CB68E90015249E /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDEB7B2A24CB68E90015249E /* VideoToolbox.framework */; }; 14 CDED1C3E24CD350600934E12 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDE0C9BE24CA247A00593A83 /* JavaScriptCore.framework */; }; 14 15 CDF1350124C9F99900432E1E /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDF1350024C9F99900432E1E /* main.mm */; }; 15 16 /* End PBXBuildFile section */ … … 28 29 29 30 /* Begin PBXFileReference section */ 30 CD89724B24CA485100AF6621 /* libwebrtc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libwebrtc.dylib; path = ../../WebKitBuild/Release/libwebrtc.dylib; sourceTree = "<group>"; };31 31 CDE0C9BE24CA247A00593A83 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 32 32 CDE0C9C024CA249A00593A83 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 33 33 CDE0C9C324CA36CD00593A83 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 34 34 CDEB7B2624CAC7420015249E /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; 35 CDEB7B2824CB558C0015249E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 36 CDEB7B2A24CB68E90015249E /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; 35 37 CDF134FD24C9F99900432E1E /* DecoderTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DecoderTest; sourceTree = BUILT_PRODUCTS_DIR; }; 36 38 CDF1350024C9F99900432E1E /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; … … 46 48 files = ( 47 49 CDE0C9C424CA36CD00593A83 /* CoreMedia.framework in Frameworks */, 48 CDE0C9BF24CA247A00593A83 /* JavaScriptCore.framework in Frameworks */, 49 CD89724C24CA485100AF6621 /* libwebrtc.dylib in Frameworks */, 50 CDEB7B2924CB558C0015249E /* CoreServices.framework in Frameworks */, 51 CDED1C3E24CD350600934E12 /* JavaScriptCore.framework in Frameworks */, 52 CDEB7B2B24CB68E90015249E /* VideoToolbox.framework in Frameworks */, 50 53 CDE0C9C124CA249A00593A83 /* WebKit.framework in Frameworks */, 51 54 ); … … 59 62 children = ( 60 63 CDE0C9C324CA36CD00593A83 /* CoreMedia.framework */, 64 CDEB7B2824CB558C0015249E /* CoreServices.framework */, 61 65 CDE0C9BE24CA247A00593A83 /* JavaScriptCore.framework */, 62 CD 89724B24CA485100AF6621 /* libwebrtc.dylib*/,66 CDEB7B2A24CB68E90015249E /* VideoToolbox.framework */, 63 67 CDE0C9C024CA249A00593A83 /* WebKit.framework */, 64 68 ); … … 87 91 isa = PBXGroup; 88 92 children = ( 93 CDEB7B2624CAC7420015249E /* config.h */, 89 94 CDF1350024C9F99900432E1E /* main.mm */, 90 CDEB7B2624CAC7420015249E /* config.h */,91 95 ); 92 96 path = DecoderTest; -
trunk/PerformanceTests/DecoderTest/DecoderTest/main.mm
r264839 r265095 29 29 #import <CoreMedia/CMFormatDescription.h> 30 30 #import <CoreMedia/CMSampleBuffer.h> 31 #import <CoreServices/CoreServices.h> 31 32 #import <Foundation/Foundation.h> 33 #import <WebCore/ContentType.h> 32 34 #import <WebCore/MediaSample.h> 33 35 #import <WebCore/RuntimeEnabledFeatures.h> 34 36 #import <WebCore/SharedBuffer.h> 35 37 #import <WebCore/SourceBufferParserWebM.h> 38 #import <WebCore/UTIUtilities.h> 36 39 #import <WebCore/VP9UtilitiesCocoa.h> 37 40 #import <WebCore/WebCoreDecompressionSession.h> 38 41 #import <getopt.h> 39 #import < webrtc/sdk/WebKit/WebKitVP9Decoder.h>42 #import <pal/avfoundation/MediaTimeAVFoundation.h> 40 43 #import <wtf/CPUTime.h> 41 44 #import <wtf/MonotonicTime.h> 42 45 #import <wtf/NeverDestroyed.h> 46 #import <wtf/URL.h> 43 47 #import <wtf/WTFSemaphore.h> 44 48 #import <wtf/cf/TypeCastsCF.h> … … 55 59 { 56 60 int enableHardwareDecoder = true; 61 int rateLimit = false; 57 62 static struct option longopts[] = { 58 63 { "hardware", no_argument, &enableHardwareDecoder, 1 }, 59 64 { "no-hardware", no_argument, &enableHardwareDecoder, 0 }, 65 { "rate-limit", no_argument, &rateLimit, 1 }, 60 66 { NULL, 0, NULL, 0 } 61 67 }; … … 65 71 fprintf(stderr, "\tOptions:\n" 66 72 "\t\t--[no-]hardware # Enable or disable the hardware decoder\n" 73 "\t\t--rate-limit # Rate limit the decoder to decode samples at the natural frame rate\n" 67 74 ); 68 75 }; … … 89 96 @autoreleasepool { 90 97 WTF::initializeMainThread(); 91 webrtc::registerWebKitVP9Decoder();98 registerWebKitVP9Decoder(); 92 99 registerSupplementalVP9Decoder(); 93 100 RuntimeEnabledFeatures::sharedFeatures().setWebMParserEnabled(true); 101 102 auto mdItem = adoptCF(MDItemCreate(kCFAllocatorDefault, filename.createCFString().get())); 103 auto mdContentType = adoptCF(checked_cf_cast<CFStringRef>(MDItemCopyAttribute(mdItem.get(), kMDItemContentType))); 104 if (!mdContentType) { 105 fprintf(stderr, "Could not discover file type of file \"%s\"\n", filename.utf8().data()); 106 return -1; 107 } 108 109 auto mimeType = MIMETypeFromUTI(mdContentType.get()); 110 if (mimeType.isEmpty() && filename.endsWith(".webm")) 111 mimeType = "video/webm"; 112 113 if (mimeType.isEmpty()) { 114 fprintf(stderr, "Could not discover file type of file \"%s\"\n", filename.utf8().data()); 115 return -1; 116 } 94 117 95 118 auto buffer = SharedBuffer::createWithContentsOfFile(filename.utf8().data()); … … 101 124 fprintf(stdout, "Parsing \"%s\"...\n", filename.utf8().data()); 102 125 103 SourceBufferParserWebM parser; 104 parser.setDidEncounterErrorDuringParsingCallback([&] (uint64_t errorCode) { 126 auto parser = SourceBufferParser::create(ContentType(mimeType)); 127 if (!buffer) { 128 fprintf(stderr, "Could not create parser for file of type \"%s\"\n", mimeType.utf8().data()); 129 return -1; 130 } 131 132 parser->setDidEncounterErrorDuringParsingCallback([&] (uint64_t errorCode) { 105 133 fprintf(stderr, "Parser encountered error %llu, exiting", errorCode); 106 134 exit(-1); … … 125 153 126 154 fprintf(stdout, "Decoded %llu samples in %g seconds (%g fps)\n", decodedSamples, duration.value(), fps); 127 if (startCPUTime && endCPUTime) 128 fprintf(stdout, "CPU Usage: %g %%\n", endCPUTime->percentageCPUUsageSince(*startCPUTime)); 155 if (startCPUTime && endCPUTime) { 156 auto percentage = endCPUTime->percentageCPUUsageSince(*startCPUTime); 157 fprintf(stdout, "CPU Usage: %g %%, (%g %% per frame)\n", percentage, percentage / decodedSamples); 158 } 129 159 }; 130 160 131 161 struct sigaction action { }; 132 162 action.sa_flags = SA_SIGINFO; 133 action.sa_sigaction = [] (int , siginfo_t*, void*) {163 action.sa_sigaction = [] (int signal, siginfo_t*, void*) { 134 164 if (updateOutputFunction()) 135 165 updateOutputFunction()(); 166 if (signal == SIGINT) 167 exit(-1); 136 168 }; 137 169 sigaction(SIGINFO, &action, nullptr); 170 sigaction(SIGINT, &action, nullptr); 138 171 139 172 WTF::Semaphore sampleSemaphore { 0 }; 140 parser .setDidProvideMediaDataCallback([&] (Ref<MediaSample>&& sample, uint64_t, const String&) {173 parser->setDidProvideMediaDataCallback([&] (Ref<MediaSample>&& sample, uint64_t, const String&) { 141 174 auto platformSample = sample->platformSample(); 142 175 if (platformSample.type != PlatformSample::CMSampleBufferType) … … 153 186 startTime = MonotonicTime::now(); 154 187 startCPUTime = CPUTime::get(); 188 155 189 fprintf(stdout, "Size: %g x %g\n", size.width(), size.height()); 156 190 firstSample = false; … … 168 202 bytes.resize(buffer->size()); 169 203 memcpy(bytes.data(), buffer->data(), buffer->size()); 170 parser .appendData(WTFMove(bytes));204 parser->appendData(WTFMove(bytes)); 171 205 dispatch_async(dispatch_get_main_queue(), [&] { 172 206 finishedParsingSemaphore.signal(); … … 174 208 }); 175 209 210 auto decompressionSession = WebCoreDecompressionSession::createOpenGL(); 176 211 Semaphore finishedDecodingSemaphore { 0 }; 177 212 auto decoderQueue = dispatch_queue_create("decoder queue", DISPATCH_QUEUE_CONCURRENT); 178 213 dispatch_async(decoderQueue, [&] { 179 auto decompressionSession = WebCoreDecompressionSession::createOpenGL();180 214 decompressionSession->setHardwareDecoderEnabled(enableHardwareDecoder); 181 215 … … 188 222 189 223 auto sample = adoptCF((CMSampleBufferRef)(const_cast<void*>(CMBufferQueueDequeueAndRetain(bufferQueue)))); 224 auto decodeStartTime = MonotonicTime::now(); 225 auto duration = PAL::toMediaTime(CMSampleBufferGetOutputDuration(sample.get())); 190 226 decompressionSession->decodeSampleSync(sample.get()); 227 auto decodeEndTime = MonotonicTime::now(); 228 auto remainingTime = Seconds(duration.toDouble()) - (decodeEndTime - decodeStartTime); 229 230 if (rateLimit && remainingTime > Seconds(0)) 231 sleep(remainingTime); 191 232 ++decodedSamples; 192 233 } while (true); -
trunk/Source/WebCore/ChangeLog
r265092 r265095 1 2020-07-30 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting. 4 https://bugs.webkit.org/show_bug.cgi?id=214807 5 6 Reviewed by Darin Adler. 7 8 Export registerWebKitVP9Decoder() from VP9UtilitiesCocoa instead of LibWebRTCProvider to make it easier 9 for DecodeTest to import, as LibWebRTCProvider also pulls in a bunch of libwebrtc headers. Also, export 10 SourceBufferParser.h so DecoderTest can create parsers for fMP4 files. 11 12 * SourcesCocoa.txt: 13 * WebCore.xcodeproj/project.pbxproj: 14 * platform/graphics/cocoa/VP9UtilitiesCocoa.h: 15 * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: 16 (WebCore::registerWebKitVP9Decoder): 17 1 18 2020-07-30 Ryosuke Niwa <rniwa@webkit.org> 2 19 -
trunk/Source/WebCore/SourcesCocoa.txt
r265079 r265095 359 359 platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp 360 360 platform/graphics/cocoa/TextTrackRepresentationCocoa.mm 361 platform/graphics/cocoa/VP9UtilitiesCocoa.mm 361 platform/graphics/cocoa/VP9UtilitiesCocoa.mm @no-unify 362 362 platform/graphics/cocoa/WebActionDisablingCALayerDelegate.mm 363 363 platform/graphics/cocoa/WebCoreCALayerExtras.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r265079 r265095 4250 4250 CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */; }; 4251 4251 CDECA89B1EDF447D00DCB08B /* AVAssetTrackUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */; }; 4252 CDED1C3C24CD305700934E12 /* VP9UtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD6FE5B824BCE645009FCDA4 /* VP9UtilitiesCocoa.mm */; }; 4252 4253 CDEF4FD717E85C8F00AEE24B /* GridLength.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEF4FD617E85C8F00AEE24B /* GridLength.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4253 4254 CDEFA2281E7669E8000AE99C /* PlatformAudioData.h in Headers */ = {isa = PBXBuildFile; fileRef = CDE667A11E4BBA4D00E8154A /* PlatformAudioData.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 35049 35050 DECA803A1F9FED6A00E3B661 /* UnifiedSource249.cpp in Sources */, 35050 35051 DECA803B1F9FED6A00E3B661 /* UnifiedSource250.cpp in Sources */, 35052 CDED1C3C24CD305700934E12 /* VP9UtilitiesCocoa.mm in Sources */, 35051 35053 DECA803C1F9FED6A00E3B661 /* UnifiedSource251.cpp in Sources */, 35052 35054 DECA803D1F9FED6A00E3B661 /* UnifiedSource252.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParser.h
r264685 r265095 38 38 class MediaSample; 39 39 40 class SourceBufferParser : public ThreadSafeRefCounted<SourceBufferParser> {40 class WEBCORE_EXPORT SourceBufferParser : public ThreadSafeRefCounted<SourceBufferParser> { 41 41 public: 42 42 static MediaPlayerEnums::SupportsType isContentTypeSupported(const ContentType&); -
trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h
r264685 r265095 39 39 WEBCORE_EXPORT extern void resetOverrideVP9ScreenSizeAndScaleForTesting(); 40 40 41 WEBCORE_EXPORT extern void registerWebKitVP9Decoder(); 41 42 WEBCORE_EXPORT extern void registerSupplementalVP9Decoder(); 42 43 extern bool isVP9DecoderAvailable(); -
trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm
r264791 r265095 30 30 31 31 #import "FourCC.h" 32 #import "LibWebRTCProvider.h" 32 33 #import "MediaCapabilitiesInfo.h" 33 34 #import "PlatformScreen.h" … … 97 98 } 98 99 100 void registerWebKitVP9Decoder() 101 { 102 LibWebRTCProvider::registerWebKitVP9Decoder(); 103 } 104 99 105 void registerSupplementalVP9Decoder() 100 106 { -
trunk/Source/WebKit/ChangeLog
r265091 r265095 1 2020-07-30 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting. 4 https://bugs.webkit.org/show_bug.cgi?id=214807 5 6 Reviewed by Darin Adler. 7 8 * WebProcess/WebProcess.cpp: 9 (WebKit::WebProcess::enableVP9Decoder): 10 1 11 2020-07-30 Tim Horton <timothy_horton@apple.com> 2 12 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r264664 r265095 1961 1961 1962 1962 m_vp9DecoderEnabled = true; 1963 LibWebRTCProvider::registerWebKitVP9Decoder();1964 1963 1965 1964 #if PLATFORM(COCOA) 1965 WebCore::registerWebKitVP9Decoder(); 1966 1966 WebCore::registerSupplementalVP9Decoder(); 1967 1967 #endif
Note: See TracChangeset
for help on using the changeset viewer.