Bug 134178 - [Mac] process raw VTT in-band captions
Summary: [Mac] process raw VTT in-band captions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on: 134224
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-22 14:41 PDT by Eric Carlson
Modified: 2014-06-24 13:02 PDT (History)
17 users (show)

See Also:


Attachments
Patch for the bots to chew on. (68.16 KB, patch)
2014-06-22 15:56 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Rebased patch (68.11 KB, patch)
2014-06-22 16:06 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Updated patch. (72.59 KB, patch)
2014-06-23 08:21 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Another patch. (73.66 KB, patch)
2014-06-23 09:17 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Eric's Patch Tweaked for Windows Build (78.00 KB, patch)
2014-06-23 11:36 PDT, Brent Fulgham
jer.noble: review+
Details | Formatted Diff | Diff
Patch for the Windows bots to try. (76.78 KB, patch)
2014-06-23 21:09 PDT, Eric Carlson
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2 (532.69 KB, application/zip)
2014-06-23 22:42 PDT, Build Bot
no flags Details
One more patch (75.20 KB, patch)
2014-06-24 06:29 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2014-06-22 14:41:47 PDT
Configure AVFoundation to deliver raw WebVTT captions.
Comment 1 Eric Carlson 2014-06-22 14:42:01 PDT
<rdar://problem/13237650>
Comment 2 Eric Carlson 2014-06-22 15:56:59 PDT
Created attachment 233577 [details]
Patch for the bots to chew on.
Comment 3 Eric Carlson 2014-06-22 16:06:47 PDT
Created attachment 233578 [details]
Rebased patch
Comment 4 WebKit Commit Bot 2014-06-22 16:09:01 PDT
Attachment 233578 [details] did not pass style-queue:


ERROR: Source/WebCore/html/track/InbandGenericTextTrack.cpp:221:  Missing space around : in range-based for statement  [whitespace/colon] [4]
ERROR: Source/WebCore/html/track/InbandGenericTextTrack.cpp:238:  Missing space around : in range-based for statement  [whitespace/colon] [4]
ERROR: Source/WebCore/loader/TextTrackLoader.cpp:219:  Missing space around : in range-based for statement  [whitespace/colon] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:79:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:80:  Wrong number of spaces before statement. (expected: 8)  [whitespace/indent] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/ISOVTTCue.cpp:30:  You should not add a blank line before implementation file's own header.  [build/include_order] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/ISOVTTCue.cpp:41:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/html/track/InbandWebVTTTextTrack.cpp:81:  Missing space around : in range-based for statement  [whitespace/colon] [4]
ERROR: Source/WebCore/html/track/InbandWebVTTTextTrack.cpp:98:  Missing space around : in range-based for statement  [whitespace/colon] [4]
ERROR: Source/WebCore/html/track/VTTCue.h:55:  The parameter name "document" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/html/track/VTTCue.h:55:  The parameter name "cue" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/platform/graphics/avfoundation/ISOVTTCue.h:35:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
ERROR: Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:113:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 15 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Eric Carlson 2014-06-23 08:21:40 PDT
Created attachment 233608 [details]
Updated patch.
Comment 6 WebKit Commit Bot 2014-06-23 08:23:37 PDT
Attachment 233608 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/avfoundation/ISOVTTCue.cpp:28:  You should not add a blank line before implementation file's own header.  [build/include_order] [4]
ERROR: Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 28 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Eric Carlson 2014-06-23 09:17:54 PDT
Created attachment 233611 [details]
Another patch.
Comment 8 Brent Fulgham 2014-06-23 11:06:16 PDT
The build failure doesn't seem to make it into the log EWS shows. It's not happy with the SOFT_LINK macro on Windows:

20>..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp(67): warning C4003: not enough actual parameters for macro 'SOFT_LINK'
20>..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp(67): error C2146: syntax error : missing ')' before identifier 'sbuf'
20>..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp(67): error C2146: syntax error : missing ';' before identifier 'sbuf'
20>..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp(67): error C2377: 'CMSampleBufferRef' : redefinition; typedef cannot be overloaded with any other symbol
20>          C:\AppleInternal\include\CoreMedia/CMSampleBuffer.h(409) : see declaration of 'CMSampleBufferRef'

SOFT_LINK on Windows looks like:

#define SOFT_LINK(library, functionName, resultType, callingConvention, parameterDeclarations, parameterNames) \

On Windows, these are defined in "CoreMediaSoftLinking.h".  I'll tweak the patch and upload a revision.
Comment 9 Brent Fulgham 2014-06-23 11:36:56 PDT
Created attachment 233618 [details]
Eric's Patch Tweaked for Windows Build
Comment 10 Jer Noble 2014-06-23 14:20:19 PDT
Comment on attachment 233618 [details]
Eric's Patch Tweaked for Windows Build

View in context: https://bugs.webkit.org/attachment.cgi?id=233618&action=review

r=me, with nits.

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:1615
> -		498770E91242C535002226BA /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D01242C535002226BA /* Shader.h */; };
> +		498770E91242C535002226BA /* (null) in Headers */ = {isa = PBXBuildFile; };

This looks like an inadvertent change.

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:-15810
> -				498770D01242C535002226BA /* Shader.h */,

Ditto.

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:25766
> -				498770E91242C535002226BA /* Shader.h in Headers */,
> +				498770E91242C535002226BA /* (null) in Headers */,

Ditto.

> Source/WebCore/html/track/InbandGenericTextTrack.cpp:249
> +WebVTTParser& InbandGenericTextTrack::parser()
> +{
> +    if (!m_webVTTParser)
> +        m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
> +    return *m_webVTTParser;
> +}
> +
> +void InbandGenericTextTrack::parseWebVTTCueData(InbandTextTrackPrivate* trackPrivate, const ISOWebVTTCue& cueData)
> +{
> +    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
> +    parser().parseCueData(cueData);
> +}
> +
> +void InbandGenericTextTrack::parseWebVTTFileHeader(InbandTextTrackPrivate* trackPrivate, String header)
> +{
> +    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
> +    parser().parseFileHeader(header);
> +}
> +
> +void InbandGenericTextTrack::newCuesParsed()
> +{
> +    Vector<RefPtr<WebVTTCueData>> cues;
> +    parser().getNewCues(cues);
> +
> +    for (auto& cueData : cues) {
> +        RefPtr<VTTCue> vttCue = VTTCue::create(*scriptExecutionContext(), *cueData);
> +
> +        if (hasCue(vttCue.get(), TextTrackCue::IgnoreDuration)) {
> +            LOG(Media, "InbandGenericTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
> +            return;
> +        }
> +        addCue(vttCue.release(), ASSERT_NO_EXCEPTION);
> +    }
> +}
> +
> +#if ENABLE(WEBVTT_REGIONS)
> +void InbandGenericTextTrack::newRegionsParsed()
> +{
> +    Vector<RefPtr<VTTRegion>> newRegions;
> +    parser().getNewRegions(newRegions);
> +
> +    for (auto& region : newRegions) {
> +        region->setTrack(this);
> +        regions()->add(region);
> +    }
> +}
> +#endif
> +
> +void InbandGenericTextTrack::fileFailedToParse()
> +{
> +    LOG(Media, "Error parsing WebVTT stream.");
> +}
> +

This looks like code duplicated from InbandWebVTTTextTrack.cpp.  Is there any way to unify those two implementations?

> Source/WebCore/platform/graphics/ISOVTTCue.cpp:145
> +        else
> +            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %zu", boxType.utf8().data(), boxSize);

Should this be an ASSERT_UNREACHED, or do we expect unexpected box types?

> Source/WebCore/platform/graphics/ISOVTTCue.h:38
> +// A ISOBox represents a ISO-BMFF box. Data in the structure is big-endian. The layout of the data structure as follows:

nit: "An ISOBox"
Comment 11 Eric Carlson 2014-06-23 15:08:39 PDT
(In reply to comment #10)
> (From update of attachment 233618 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=233618&action=review
> 
> r=me, with nits.
> 
> > Source/WebCore/WebCore.xcodeproj/project.pbxproj:1615
> > -		498770E91242C535002226BA /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D01242C535002226BA /* Shader.h */; };
> > +		498770E91242C535002226BA /* (null) in Headers */ = {isa = PBXBuildFile; };
> 
> This looks like an inadvertent change.
> 
> > Source/WebCore/WebCore.xcodeproj/project.pbxproj:-15810
> > -				498770D01242C535002226BA /* Shader.h */,
> 
> Ditto.
> 
> > Source/WebCore/WebCore.xcodeproj/project.pbxproj:25766
> > -				498770E91242C535002226BA /* Shader.h in Headers */,
> > +				498770E91242C535002226BA /* (null) in Headers */,
> 
> Ditto.
> 

All fixed.

> > Source/WebCore/html/track/InbandGenericTextTrack.cpp:249
> > +WebVTTParser& InbandGenericTextTrack::parser()
> > +{
> > +    if (!m_webVTTParser)
> > +        m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
> > +    return *m_webVTTParser;
> > +}
> > +
> > +void InbandGenericTextTrack::parseWebVTTCueData(InbandTextTrackPrivate* trackPrivate, const ISOWebVTTCue& cueData)
> > +{
> > +    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
> > +    parser().parseCueData(cueData);
> > +}
> > +
> > +void InbandGenericTextTrack::parseWebVTTFileHeader(InbandTextTrackPrivate* trackPrivate, String header)
> > +{
> > +    ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
> > +    parser().parseFileHeader(header);
> > +}
> > +
> > +void InbandGenericTextTrack::newCuesParsed()
> > +{
> > +    Vector<RefPtr<WebVTTCueData>> cues;
> > +    parser().getNewCues(cues);
> > +
> > +    for (auto& cueData : cues) {
> > +        RefPtr<VTTCue> vttCue = VTTCue::create(*scriptExecutionContext(), *cueData);
> > +
> > +        if (hasCue(vttCue.get(), TextTrackCue::IgnoreDuration)) {
> > +            LOG(Media, "InbandGenericTextTrack::newCuesParsed ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n", vttCue->startTime(), vttCue->endTime(), vttCue->text().utf8().data());
> > +            return;
> > +        }
> > +        addCue(vttCue.release(), ASSERT_NO_EXCEPTION);
> > +    }
> > +}
> > +
> > +#if ENABLE(WEBVTT_REGIONS)
> > +void InbandGenericTextTrack::newRegionsParsed()
> > +{
> > +    Vector<RefPtr<VTTRegion>> newRegions;
> > +    parser().getNewRegions(newRegions);
> > +
> > +    for (auto& region : newRegions) {
> > +        region->setTrack(this);
> > +        regions()->add(region);
> > +    }
> > +}
> > +#endif
> > +
> > +void InbandGenericTextTrack::fileFailedToParse()
> > +{
> > +    LOG(Media, "Error parsing WebVTT stream.");
> > +}
> > +
> 
> This looks like code duplicated from InbandWebVTTTextTrack.cpp.  Is there any way to unify those two implementations?
> 

I don't have a good way to combine them, and I hope I can remove this completely in the future so I have left it for now.

> > Source/WebCore/platform/graphics/ISOVTTCue.cpp:145
> > +        else
> > +            LOG(Media, "ISOWebVTTCue::ISOWebVTTCue - skipping box id = \"%s\", size = %zu", boxType.utf8().data(), boxSize);
> 
> Should this be an ASSERT_UNREACHED, or do we expect unexpected box types?
> 

Unexpected box types are not illegal.

> > Source/WebCore/platform/graphics/ISOVTTCue.h:38
> > +// A ISOBox represents a ISO-BMFF box. Data in the structure is big-endian. The layout of the data structure as follows:
> 
> nit: "An ISOBox"

Fixed.

Thanks!
Comment 12 Eric Carlson 2014-06-23 15:10:05 PDT
Committed http://trac.webkit.org/changeset/170323, with a followup fix in https://trac.webkit.org/r170324
Comment 13 WebKit Commit Bot 2014-06-23 16:13:21 PDT
Re-opened since this is blocked by bug 134224
Comment 14 Eric Carlson 2014-06-23 21:09:51 PDT
Created attachment 233676 [details]
Patch for the Windows bots to try.
Comment 15 WebKit Commit Bot 2014-06-23 21:11:02 PDT
Attachment 233676 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/ISOVTTCue.cpp:28:  You should not add a blank line before implementation file's own header.  [build/include_order] [4]
ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 2 in 30 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 16 Build Bot 2014-06-23 22:41:56 PDT
Comment on attachment 233676 [details]
Patch for the Windows bots to try.

Attachment 233676 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4790173812391936

New failing tests:
fullscreen/video-cursor-auto-hide.html
Comment 17 Build Bot 2014-06-23 22:42:01 PDT
Created attachment 233682 [details]
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-14  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 18 Eric Carlson 2014-06-24 06:29:42 PDT
Created attachment 233697 [details]
One more patch
Comment 19 Eric Carlson 2014-06-24 12:38:13 PDT
Committed r170379: https://trac.webkit.org/r170379
Comment 20 Eric Carlson 2014-06-24 12:38:39 PDT
The latest patch builds on Windows for Brent, so our theory is that the EWS build failure it spurious but I will watch the builders be certain
Comment 21 Eric Carlson 2014-06-24 13:02:03 PDT
Plus a build fix in https://trac.webkit.org/r170384