Changeset 271270 in webkit
- Timestamp:
- Jan 7, 2021, 4:18:32 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (1 diff)
-
WebCore/dom/Document.cpp (modified) (3 diffs)
-
WebCore/dom/Document.h (modified) (2 diffs)
-
WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (modified) (22 diffs)
-
WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp (modified) (7 diffs)
-
WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.h (modified) (4 diffs)
-
WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.cpp (modified) (7 diffs)
-
WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271269 r271270 1 2021-01-07 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] Add runtime logging to format reader and WebM parser 4 https://bugs.webkit.org/show_bug.cgi?id=220423 5 <rdar://problem/72896655> 6 7 Reviewed by Andy Estes. 8 9 Add a shared Logger to Document that can be used by singletons or objects that don't 10 have access to a Document. To ensure that the shared logger doesn't log activity 11 from a private session, it is disabled if *any* Document in the process doesn't 12 allow logging. 13 14 * WebCore.xcodeproj/project.pbxproj: 15 * dom/Document.cpp: 16 (WebCore::sharedLoggerOwner): 17 (WebCore::staticSharedLogger): 18 (WebCore::Document::sharedLogger): 19 (WebCore::Document::configureSharedLogger): 20 (WebCore::Document::addToDocumentsMap): 21 (WebCore::Document::removeFromDocumentsMap): 22 (WebCore::m_selection): 23 (WebCore::Document::~Document): 24 * dom/Document.h: 25 * platform/graphics/cocoa/SourceBufferParserWebM.cpp: 26 (WTF::LogArgument<webm::TrackType>::toString): 27 (WebCore::logChannel): 28 (WebCore::logClassName): 29 (WebCore::SourceBufferParserWebM::appendData): 30 (WebCore::SourceBufferParserWebM::setLogger): 31 (WebCore::SourceBufferParserWebM::OnElementBegin): 32 (WebCore::SourceBufferParserWebM::OnElementEnd): 33 (WebCore::SourceBufferParserWebM::OnEbml): 34 (WebCore::SourceBufferParserWebM::OnSegmentBegin): 35 (WebCore::SourceBufferParserWebM::OnInfo): 36 (WebCore::SourceBufferParserWebM::OnClusterBegin): 37 (WebCore::SourceBufferParserWebM::OnTrackEntry): 38 (WebCore::SourceBufferParserWebM::OnBlockBegin): 39 (WebCore::SourceBufferParserWebM::OnBlockEnd): 40 (WebCore::SourceBufferParserWebM::OnSimpleBlockBegin): 41 (WebCore::SourceBufferParserWebM::OnSimpleBlockEnd): 42 (WebCore::SourceBufferParserWebM::OnBlockGroupBegin): 43 (WebCore::SourceBufferParserWebM::OnBlockGroupEnd): 44 (WebCore::SourceBufferParserWebM::OnFrame): 45 * platform/graphics/cocoa/SourceBufferParserWebM.h: 46 1 47 2021-01-07 Alexey Shvayka <shvaikalesh@gmail.com> 2 48 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r271188 r271270 3428 3428 A81872200977D3C0005826D9 /* ChildNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872150977D3C0005826D9 /* ChildNodeList.h */; }; 3429 3429 A81872230977D3C0005826D9 /* NamedNodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A81872180977D3C0005826D9 /* NamedNodeMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3430 A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; };3430 A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3431 3431 A824B4650E2EF2EA0081A7B7 /* TextRun.h in Headers */ = {isa = PBXBuildFile; fileRef = A824B4640E2EF2EA0081A7B7 /* TextRun.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3432 3432 A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581E809D1508D000E61D7 /* SVGNames.cpp */; }; -
trunk/Source/WebCore/dom/Document.cpp
r271146 r271270 516 516 uint64_t Document::s_globalTreeVersion = 0; 517 517 518 static const void* sharedLoggerOwner() 519 { 520 static uint64_t owner = cryptographicallyRandomNumber(); 521 return reinterpret_cast<const void*>(owner); 522 } 523 524 static Logger*& staticSharedLogger() 525 { 526 static Logger* logger; 527 return logger; 528 } 529 530 const Logger& Document::sharedLogger() 531 { 532 if (!staticSharedLogger()) { 533 staticSharedLogger() = &Logger::create(sharedLoggerOwner()).leakRef(); 534 configureSharedLogger(); 535 } 536 537 return *staticSharedLogger(); 538 } 539 540 void Document::configureSharedLogger() 541 { 542 auto logger = staticSharedLogger(); 543 if (!logger) 544 return; 545 546 bool alwaysOnLoggingAllowed = !allDocumentsMap().isEmpty() && WTF::allOf(allDocumentsMap().values(), [](auto* document) { 547 auto* page = document->page(); 548 return !page || page->sessionID().isAlwaysOnLoggingAllowed(); 549 }); 550 logger->setEnabled(sharedLoggerOwner(), alwaysOnLoggingAllowed); 551 } 552 553 auto Document::addToDocumentsMap() -> DocumentsMap::AddResult 554 { 555 auto addResult = allDocumentsMap().add(m_identifier, this); 556 configureSharedLogger(); 557 558 return addResult; 559 } 560 561 void Document::removeFromDocumentsMap() 562 { 563 ASSERT(allDocumentsMap().contains(m_identifier)); 564 allDocumentsMap().remove(m_identifier); 565 configureSharedLogger(); 566 } 567 518 568 auto Document::allDocumentsMap() -> DocumentsMap& 519 569 { … … 590 640 , m_selection(makeUniqueRef<FrameSelection>(this)) 591 641 { 592 auto addResult = a llDocumentsMap().add(m_identifier, this);642 auto addResult = addToDocumentsMap(); 593 643 ASSERT_UNUSED(addResult, addResult.isNewEntry); 594 644 … … 650 700 #endif 651 701 652 ASSERT(allDocumentsMap().contains(m_identifier));653 allDocumentsMap().remove(m_identifier); 702 removeFromDocumentsMap(); 703 654 704 // We need to remove from the contexts map very early in the destructor so that calling postTask() on this Document from another thread is safe. 655 705 removeFromContextsMap(); -
trunk/Source/WebCore/dom/Document.h
r270974 r271270 1493 1493 1494 1494 Logger& logger(); 1495 WEBCORE_EXPORT static const Logger& sharedLogger(); 1495 1496 1496 1497 WEBCORE_EXPORT void setConsoleMessageListener(RefPtr<StringCallback>&&); // For testing. … … 1719 1720 1720 1721 void didLogMessage(const WTFLogChannel&, WTFLogLevel, Vector<JSONLogValue>&&) final; 1722 static void configureSharedLogger(); 1723 1724 DocumentsMap::AddResult addToDocumentsMap(); 1725 void removeFromDocumentsMap(); 1721 1726 1722 1727 const Ref<const Settings> m_settings; -
trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp
r271214 r271270 61 61 62 62 template<typename> struct LogArgument; 63 64 template<> struct LogArgument<webm::TrackType> { 65 static String toString(webm::TrackType type) 66 { 67 switch (type) { 68 case webm::TrackType::kVideo: return "Video"_s; 69 case webm::TrackType::kAudio: return "Audio"_s; 70 case webm::TrackType::kComplex: return "Complex"_s; 71 case webm::TrackType::kLogo: return "Logo"_s; 72 case webm::TrackType::kSubtitle: return "Subtitle"_s; 73 case webm::TrackType::kButtons: return "Buttons"_s; 74 case webm::TrackType::kControl: return "Control"_s; 75 } 76 return "Unknown"_s; 77 } 78 }; 63 79 64 80 template<> struct LogArgument<webm::Id> { … … 244 260 using namespace PAL; 245 261 246 #if !RELEASE_LOG_DISABLED 247 static WTFLogChannel& logChannel() { return LogMediaSource; } 262 static WTFLogChannel& logChannel() { return LogMedia; } 248 263 static const char* logClassName() { return "SourceBufferParserWebM"; } 249 #endif250 264 251 265 // FIXME: Remove this once kCMVideoCodecType_VP9 is added to CMFormatDescription.h … … 628 642 // parsed as a top-level element, rather than as a child of the Segment. 629 643 if (!m_reader->rewindTo(*m_rewindToPosition)) { 630 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "failed to rewind reader , bailing");644 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "failed to rewind reader"); 631 645 break; 632 646 } … … 689 703 } 690 704 691 #if !RELEASE_LOG_DISABLED692 705 void SourceBufferParserWebM::setLogger(const Logger& logger, const void* logIdentifier) 693 706 { … … 695 708 m_logIdentifier = logIdentifier; 696 709 } 697 #endif698 710 699 711 auto SourceBufferParserWebM::trackDataForTrackNumber(uint64_t trackNumber) -> TrackData* … … 721 733 if ((m_state == State::None && metadata.id != Id::kEbml && metadata.id != Id::kSegment) 722 734 || (m_state == State::ReadingSegment && metadata.id != Id::kInfo && metadata.id != Id::kTracks && metadata.id != Id::kCluster)) { 723 DEBUG_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", m_state, "), id(", metadata.id, "), position(", metadata.position, "), headerSize(", metadata.header_size, "), size(", metadata.size, "), skipping");735 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", m_state, "), id(", metadata.id, "), position(", metadata.position, "), headerSize(", metadata.header_size, "), size(", metadata.size, "), skipping"); 724 736 725 737 *action = Action::kSkip; … … 727 739 } 728 740 729 #if !RELEASE_LOG_DISABLED730 741 auto oldState = m_state; 731 #endif732 742 733 743 if (metadata.id == Id::kEbml) … … 744 754 m_state = State::ReadingCluster; 745 755 746 DEBUG_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", oldState, "->", m_state, "), id(", metadata.id, "), position(", metadata.position, "), headerSize(", metadata.header_size, "), size(", metadata.size, ")");756 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", oldState, "->", m_state, "), id(", metadata.id, "), position(", metadata.position, "), headerSize(", metadata.header_size, "), size(", metadata.size, ")"); 747 757 748 758 return Status(Status::kOkCompleted); … … 752 762 { 753 763 UNUSED_PARAM(metadata); 754 755 #if !RELEASE_LOG_DISABLED 764 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 765 756 766 auto oldState = m_state; 757 #endif758 767 759 768 if (metadata.id == Id::kEbml || metadata.id == Id::kSegment) … … 764 773 m_state = State::ReadingTracks; 765 774 766 DEBUG_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", oldState, "->", m_state, "), id(", metadata.id, "), size(", metadata.size, ")");775 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER, "state(", oldState, "->", m_state, "), id(", metadata.id, "), size(", metadata.size, ")"); 767 776 768 777 return Status(Status::kOkCompleted); … … 772 781 { 773 782 UNUSED_PARAM(metadata); 783 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 784 774 785 if (ebml.doc_type.is_present() && ebml.doc_type.value().compare("webm")) 775 786 return Status(Status::Code(ErrorCode::InvalidDocType)); … … 784 795 { 785 796 UNUSED_PARAM(metadata); 797 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 798 786 799 if (!m_initializationSegmentEncountered) { 787 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered Segment before Embl , bailing");800 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered Segment before Embl"); 788 801 return Status(Status::Code(ErrorCode::InvalidInitSegment)); 789 802 } … … 800 813 { 801 814 UNUSED_PARAM(metadata); 815 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 816 802 817 if (!m_initializationSegmentEncountered || !m_initializationSegment) { 803 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered Info outside Segment , bailing");818 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered Info outside Segment"); 804 819 return Status(Status::Code(ErrorCode::InvalidInitSegment)); 805 820 } … … 815 830 { 816 831 UNUSED_PARAM(metadata); 817 UNUSED_PARAM(cluster); 832 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 833 818 834 ASSERT(action); 819 835 if (!action) … … 850 866 String codecId { trackEntry.codec_id.value().data(), (unsigned)trackEntry.codec_id.value().length() }; 851 867 868 ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER, trackType, ", codec ", codecId); 869 852 870 if (trackType == TrackType::kVideo && !supportedVideoCodecs().contains(codecId)) { 853 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered unsupported video codec ID \"", codecId, "\", bailing");871 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered unsupported video codec ID ", codecId); 854 872 return Status(Status::Code(ErrorCode::UnsupportedVideoCodec)); 855 873 } 856 874 857 875 if (trackType == TrackType::kAudio && !supportedAudioCodecs().contains(codecId)) { 858 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered unsupported audio codec ID \"", codecId, "\", bailing");876 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "Encountered unsupported audio codec ID ", codecId); 859 877 return Status(Status::Code(ErrorCode::UnsupportedAudioCodec)); 860 878 } 861 879 862 if (trackType == TrackType::kVideo) 863 m_initializationSegment->videoTracks.append({ MediaDescriptionWebM::create(TrackEntry(trackEntry)), VideoTrackPrivateWebM::create(TrackEntry(trackEntry)) }); 864 else if (trackType == TrackType::kAudio) 865 m_initializationSegment->audioTracks.append({ MediaDescriptionWebM::create(TrackEntry(trackEntry)), AudioTrackPrivateWebM::create(TrackEntry(trackEntry)) }); 880 if (trackType == TrackType::kVideo) { 881 auto track = VideoTrackPrivateWebM::create(TrackEntry(trackEntry)); 882 if (m_logger) 883 track->setLogger(*m_logger, LoggerHelper::childLogIdentifier(m_logIdentifier, ++m_nextChildIdentifier)); 884 m_initializationSegment->videoTracks.append({ MediaDescriptionWebM::create(TrackEntry(trackEntry)), WTFMove(track) }); 885 } else if (trackType == TrackType::kAudio) { 886 auto track = AudioTrackPrivateWebM::create(TrackEntry(trackEntry)); 887 if (m_logger) 888 track->setLogger(*m_logger, LoggerHelper::childLogIdentifier(m_logIdentifier, ++m_nextChildIdentifier)); 889 m_initializationSegment->audioTracks.append({ MediaDescriptionWebM::create(TrackEntry(trackEntry)), WTFMove(track) }); 890 } 866 891 867 892 StringView codecString { trackEntry.codec_id.value().data(), (unsigned)trackEntry.codec_id.value().length() }; … … 898 923 { 899 924 UNUSED_PARAM(metadata); 925 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 926 900 927 ASSERT(action); 901 928 if (!action) … … 913 940 UNUSED_PARAM(metadata); 914 941 UNUSED_PARAM(block); 942 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 915 943 916 944 m_currentBlock = WTF::nullopt; … … 922 950 { 923 951 UNUSED_PARAM(metadata); 952 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 953 924 954 ASSERT(action); 925 955 if (!action) … … 936 966 { 937 967 UNUSED_PARAM(metadata); 968 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 969 938 970 UNUSED_PARAM(block); 939 971 … … 946 978 { 947 979 UNUSED_PARAM(metadata); 980 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 981 948 982 ASSERT(action); 949 983 if (!action) … … 958 992 UNUSED_PARAM(metadata); 959 993 UNUSED_PARAM(blockGroup); 994 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER); 960 995 return Status(Status::kOkCompleted); 961 996 } … … 967 1002 return Status(Status::kNotEnoughMemory); 968 1003 969 if (!m_currentBlock) 1004 if (!m_currentBlock) { 1005 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "no current block!"); 970 1006 return Status(Status::kInvalidElementId); 1007 } 971 1008 972 1009 auto* block = WTF::switchOn(*m_currentBlock, [](Block& block) { -
trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h
r271253 r271270 271 271 RefPtr<const WTF::Logger> m_logger; 272 272 const void* m_logIdentifier { nullptr }; 273 uint64_t m_nextChildIdentifier { 0 }; 273 274 }; 274 275 -
trunk/Source/WebKit/ChangeLog
r271269 r271270 1 2021-01-07 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] Add runtime logging to format reader and WebM parser 4 https://bugs.webkit.org/show_bug.cgi?id=220423 5 <rdar://problem/72896655> 6 7 Reviewed by Andy Estes. 8 9 Use the Document::sharedLogger to log format and track reader state changes 10 and errors. 11 12 * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: 13 (WebKit::nextLogIdentifier): 14 (WebKit::logChannel): 15 (WebKit::logClassName): 16 (WebKit::MediaFormatReader::parseByteSource): 17 (WebKit::MediaFormatReader::didParseTracks): 18 (WebKit::MediaFormatReader::copyProperty): 19 (WebKit::MediaFormatReader::nextTrackReaderLogIdentifier const): 20 * Shared/mac/MediaFormatReader/MediaFormatReader.h: 21 * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.cpp: 22 (WebKit::MediaTrackReader::MediaTrackReader): 23 (WebKit::MediaTrackReader::finishParsing): 24 (WebKit::MediaTrackReader::mediaTypeString const): 25 (WebKit::MediaTrackReader::copyProperty): 26 (WebKit::MediaTrackReader::finalize): 27 (WebKit::MediaTrackReader::logChannel const): 28 * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.h: 29 1 30 2021-01-07 Alexey Shvayka <shvaikalesh@gmail.com> 2 31 -
trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp
r271253 r271270 32 32 #include <WebCore/AudioTrackPrivate.h> 33 33 #include <WebCore/ContentType.h> 34 #include <WebCore/Document.h> 34 35 #include <WebCore/InbandTextTrackPrivate.h> 36 #include <WebCore/Logging.h> 35 37 #include <WebCore/MediaSample.h> 36 38 #include <WebCore/SourceBufferParserWebM.h> 37 39 #include <WebCore/VideoTrackPrivate.h> 38 40 #include <pal/avfoundation/MediaTimeAVFoundation.h> 41 #include <wtf/LoggerHelper.h> 39 42 #include <wtf/WorkQueue.h> 40 43 … … 47 50 using namespace PAL; 48 51 using namespace WebCore; 52 53 static const void* nextLogIdentifier() 54 { 55 static uint64_t logIdentifier = cryptographicallyRandomNumber(); 56 return reinterpret_cast<const void*>(++logIdentifier); 57 } 58 59 static WTFLogChannel& logChannel() { return WebCore::LogMedia; } 60 static const char* logClassName() { return "MediaFormatReader"; } 49 61 50 62 CMBaseClassID MediaFormatReader::wrapperClassID() … … 98 110 } 99 111 112 if (!m_logger) { 113 m_logger = makeRefPtr(Document::sharedLogger()); 114 m_logIdentifier = nextLogIdentifier(); 115 } 116 117 ALWAYS_LOG(LOGIDENTIFIER); 118 parser->setLogger(*m_logger, m_logIdentifier); 119 100 120 // Set a minimum audio sample duration of 0 so the parser creates indivisible samples with byte source ranges. 101 121 parser->setMinimumAudioSampleDuration(0); … … 141 161 ASSERT(m_trackReaders.isEmpty()); 142 162 163 ALWAYS_LOG(LOGIDENTIFIER); 164 if (errorCode) 165 ERROR_LOG(LOGIDENTIFIER, errorCode); 166 143 167 m_parseTracksStatus = errorCode ? kMTPluginFormatReaderError_ParsingFailure : noErr; 144 168 m_duration = WTFMove(segment.duration); … … 187 211 { 188 212 ASSERT(!isMainThread()); 213 ALWAYS_LOG(LOGIDENTIFIER); 189 214 190 215 auto locker = holdLock(m_parseTracksLock); … … 214 239 } 215 240 241 ERROR_LOG(LOGIDENTIFIER, "asked for unsupported property ", String(key)); 216 242 return kCMBaseObjectError_ValueNotAvailable; 217 243 } … … 235 261 } 236 262 263 const void* MediaFormatReader::nextTrackReaderLogIdentifier(uint64_t trackID) const 264 { 265 return LoggerHelper::childLogIdentifier(m_logIdentifier, trackID); 266 } 267 237 268 } // namespace WebKit 238 269 -
trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.h
r271253 r271270 32 32 #include <wtf/Condition.h> 33 33 #include <wtf/Lock.h> 34 #include <wtf/Logger.h> 34 35 35 36 DECLARE_CORE_MEDIA_TRAITS(FormatReader); … … 56 57 const MediaTime& duration() const { return m_duration; } 57 58 59 const Logger& logger() const { ASSERT(m_logger); return *m_logger.get(); } 60 const void* nextTrackReaderLogIdentifier(uint64_t) const; 61 58 62 private: 59 63 explicit MediaFormatReader(Allocator&&); … … 72 76 // WrapperClass 73 77 OSStatus copyTrackArray(CFArrayRef*); 78 79 const void* logIdentifier() const { return m_logIdentifier; } 74 80 75 81 RetainPtr<MTPluginByteSourceRef> m_byteSource; … … 79 85 Optional<OSStatus> m_parseTracksStatus; 80 86 Vector<Ref<MediaTrackReader>> m_trackReaders; 87 RefPtr<const Logger> m_logger; 88 const void* m_logIdentifier; 81 89 }; 82 90 -
trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.cpp
r271253 r271270 34 34 #include <WebCore/AudioTrackPrivate.h> 35 35 #include <WebCore/InbandTextTrackPrivate.h> 36 #include <WebCore/Logging.h> 36 37 #include <WebCore/MediaDescription.h> 37 38 #include <WebCore/SampleMap.h> … … 74 75 , m_mediaType(mediaType) 75 76 , m_duration(formatReader.duration()) 77 , m_logger(formatReader.logger()) 78 , m_logIdentifier(formatReader.nextTrackReaderLogIdentifier(trackID)) 76 79 { 77 80 ASSERT(!isMainThread()); 78 81 82 ALWAYS_LOG(LOGIDENTIFIER, mediaTypeString(), " ", trackID); 79 83 if (enabled) 80 84 m_isEnabled = enabled.value() ? Enabled::True : Enabled::False; … … 113 117 { 114 118 ASSERT(!isMainThread()); 119 120 ALWAYS_LOG(LOGIDENTIFIER); 115 121 auto locker = holdLock(m_sampleStorageLock); 116 122 if (!m_sampleStorage) 117 123 m_sampleStorage = makeUnique<SampleStorage>(); 118 124 m_sampleStorage->hasAllSamples = true; 119 if (m_isEnabled == Enabled::Unknown) 125 if (m_isEnabled == Enabled::Unknown) { 120 126 m_isEnabled = m_sampleStorage->sampleMap.empty() ? Enabled::False : Enabled::True; 127 if (m_isEnabled == Enabled::False) 128 ERROR_LOG(LOGIDENTIFIER, "ignoring empty ", mediaTypeString(), " track"); 129 } 121 130 m_sampleStorageCondition.notifyAll(); 131 } 132 133 const char* MediaTrackReader::mediaTypeString() const 134 { 135 switch (m_mediaType) { 136 case kCMMediaType_Video: 137 return "video"; 138 break; 139 case kCMMediaType_Audio: 140 return "audio"; 141 break; 142 case kCMMediaType_Text: 143 return "text"; 144 break; 145 } 146 ASSERT_NOT_REACHED(); 147 return "unknown"; 122 148 } 123 149 … … 138 164 139 165 if (CFEqual(key, PAL::get_MediaToolbox_kMTPluginTrackReaderProperty_Enabled())) { 140 if (m_isEnabled == Enabled::Unknown) 166 if (m_isEnabled == Enabled::Unknown) { 141 167 m_isEnabled = sampleMap.empty() ? Enabled::False : Enabled::True; 168 if (m_isEnabled == Enabled::False) 169 ERROR_LOG(LOGIDENTIFIER, "ignoring empty ", mediaTypeString(), " track"); 170 } 142 171 143 172 *reinterpret_cast<CFBooleanRef*>(copiedValue) = retainPtr(m_isEnabled == Enabled::True ? kCFBooleanTrue : kCFBooleanFalse).leakRef(); … … 145 174 } 146 175 147 if (sampleMap.empty()) 176 if (sampleMap.empty()) { 177 ERROR_LOG(LOGIDENTIFIER, "sample table empty when asked for ", String(key)); 148 178 return kCMBaseObjectError_ValueNotAvailable; 179 } 149 180 150 181 auto& lastSample = *sampleMap.decodeOrder().rbegin()->second; … … 163 194 } 164 195 196 ERROR_LOG(LOGIDENTIFIER, "asked for unsupported property ", String(key)); 165 197 return kCMBaseObjectError_ValueNotAvailable; 166 198 } … … 200 232 } 201 233 234 WTFLogChannel& MediaTrackReader::logChannel() const 235 { 236 return WebCore::LogMedia; 237 } 238 202 239 } // namespace WebKit 203 240 -
trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.h
r271253 r271270 91 91 }; 92 92 93 const char* mediaTypeString() const; 94 const WTF::Logger& logger() const { return m_logger; } 95 const char* logClassName() const { return "MediaTrackReader"; } 96 const void* logIdentifier() const { return m_logIdentifier; } 97 WTFLogChannel& logChannel() const; 98 93 99 enum Enabled : uint8_t { Unknown, False, True }; 94 100 … … 100 106 mutable Lock m_sampleStorageLock; 101 107 mutable std::unique_ptr<SampleStorage> m_sampleStorage; 108 Ref<const Logger> m_logger; 109 const void* m_logIdentifier; 102 110 }; 103 111
Note:
See TracChangeset
for help on using the changeset viewer.