Bug 71341

Summary: Add Clock class and platform-specific implementations.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: New BugsAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, acolwell, eric.carlson, ojan, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 71408    
Attachments:
Description Flags
Add Clock, PlatformClockCA, and PlatformClockPOSIX
none
MediaController and HTMLMediaElement changes.
abarth: review-
Source/JavaScriptCore: Implement MediaController.
none
Source/WebCore: Implement MediaController.
none
Patch
sam: review+
Patch none

Jer Noble
Reported 2011-11-01 17:19:37 PDT
Implement MediaController.
Attachments
Add Clock, PlatformClockCA, and PlatformClockPOSIX (24.93 KB, patch)
2011-11-02 11:20 PDT, Jer Noble
no flags
MediaController and HTMLMediaElement changes. (71.56 KB, patch)
2011-11-02 13:31 PDT, Jer Noble
abarth: review-
Source/JavaScriptCore: Implement MediaController. (24.91 KB, patch)
2011-11-02 16:34 PDT, Jer Noble
no flags
Source/WebCore: Implement MediaController. (70.14 KB, patch)
2011-11-02 16:34 PDT, Jer Noble
no flags
Patch (24.93 KB, patch)
2011-11-02 16:38 PDT, Jer Noble
sam: review+
Patch (70.11 KB, patch)
2011-11-02 16:40 PDT, Jer Noble
no flags
Jer Noble
Comment 1 2011-11-02 11:20:28 PDT
Created attachment 113339 [details] Add Clock, PlatformClockCA, and PlatformClockPOSIX
Jer Noble
Comment 2 2011-11-02 13:31:17 PDT
Created attachment 113364 [details] MediaController and HTMLMediaElement changes.
Adam Barth
Comment 3 2011-11-02 14:49:50 PDT
Comment on attachment 113339 [details] Add Clock, PlatformClockCA, and PlatformClockPOSIX View in context: https://bugs.webkit.org/attachment.cgi?id=113339&action=review We should be able to do this without virtual functions. > Source/WebCore/platform/Clock.cpp:44 > +PassRefPtr<Clock> Clock::create() > +{ > +#if USE(COREAUDIO) > + return adoptRef(new PlatformClockCA()); > +#else > + return adoptRef(new PlatformClockPOSIX()); > +#endif > +} Would it make sense to move Clock::create to PlatformClockCA.cpp and PlatformClockPOSIX.cpp, respectively? > Source/WebCore/platform/Clock.h:47 > + virtual void setCurrentTime(float) = 0; > + virtual float currentTime() const = 0; > + > + virtual void setPlayRate(float) = 0; > + virtual float playRate() const = 0; > + > + virtual void start() = 0; > + virtual void stop() = 0; > + virtual bool isRunning() const = 0; Why virtual functions? If only one implementation will be linked in at a time, there's no need for virtual functions.
Adam Barth
Comment 4 2011-11-02 14:51:22 PDT
Comment on attachment 113364 [details] MediaController and HTMLMediaElement changes. This patch is based on an old version of WebKit. Can you merge this to top-of-tree so we can see what the patch will look like when landed?
Adam Barth
Comment 5 2011-11-02 14:51:54 PDT
Also, we prefer to have one patch per bug. If you'd like to land these separately (which I think makes sense) please consider using multiple bugs.
Jer Noble
Comment 6 2011-11-02 15:01:28 PDT
(In reply to comment #3) > (From update of attachment 113339 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113339&action=review > > We should be able to do this without virtual functions. > Would it make sense to move Clock::create to PlatformClockCA.cpp and PlatformClockPOSIX.cpp, respectively? See below. :) > Why virtual functions? If only one implementation will be linked in at a time, there's no need for virtual functions. There may be more than one implementation at a time. We are working on a clock subclass which can synchronize AVFoundation-based media elements, but would still need a CA or POSIX clock to synchronize between QTKit- and AVFoundation-based elements.
Jer Noble
Comment 7 2011-11-02 15:02:14 PDT
(In reply to comment #5) > Also, we prefer to have one patch per bug. If you'd like to land these separately (which I think makes sense) please consider using multiple bugs. Sure thing. I'll update the title of this bug, obsolete the MediaController patch, and file new bugs for the subsequent patches.
Jer Noble
Comment 8 2011-11-02 15:08:57 PDT
Filed bug #71408 and bug #71410 and marked as depending on this bug. I'll rebase my changes and get the updated.
Adam Barth
Comment 9 2011-11-02 15:21:23 PDT
Thanks.
Jer Noble
Comment 10 2011-11-02 16:34:22 PDT
Created attachment 113396 [details] Source/JavaScriptCore: Implement MediaController.
Jer Noble
Comment 11 2011-11-02 16:34:38 PDT
Created attachment 113397 [details] Source/WebCore: Implement MediaController.
Jer Noble
Comment 12 2011-11-02 16:38:29 PDT
Created attachment 113399 [details] Patch After a disasterous use of webkit-patch post-commit, webkit-patch upload is back to save the day...
Jer Noble
Comment 13 2011-11-02 16:40:01 PDT
Jer Noble
Comment 14 2011-11-02 16:42:12 PDT
Sigh. webkit-patch upload is still broken. (Adds the wrong patch to the wrong bug.)
Jer Noble
Comment 15 2011-11-02 16:47:27 PDT
Adam Barth
Comment 16 2011-11-02 17:01:57 PDT
Comment on attachment 113399 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113399&action=review PlatformClockPOSIX looks fine. I'm not sure I fully understand the role of m_offset. I don't know enough about CoreAudio to review that implementation. > Source/WebCore/platform/posix/PlatformClockPOSIX.cpp:35 > + return val.tv_sec + (val.tv_usec / 1000000.0f); I would have named this constant, but I'm not sure that's a big deal. > Source/WebCore/platform/posix/PlatformClockPOSIX.cpp:43 > + if (delta.tv_usec < 0) { Does this need to be a loop? I'm not sure how much error checking you want to do here.
Jer Noble
Comment 17 2011-11-02 21:53:42 PDT
(In reply to comment #16) > (From update of attachment 113399 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113399&action=review > > PlatformClockPOSIX looks fine. I'm not sure I fully understand the role of m_offset. I don't know enough about CoreAudio to review that implementation. Sure thing. The general idea is that: current time = (now - start time) * rate + offset, and the offset gets reset whenever the clock is paused, played, or the rate changes. > > Source/WebCore/platform/posix/PlatformClockPOSIX.cpp:35 > > + return val.tv_sec + (val.tv_usec / 1000000.0f); > > I would have named this constant, but I'm not sure that's a big deal. I can add that. usecPerSec or similar. > > Source/WebCore/platform/posix/PlatformClockPOSIX.cpp:43 > > + if (delta.tv_usec < 0) { > > Does this need to be a loop? I'm not sure how much error checking you want to do here. Unless something goes seriously wrong with gettimeofday, this will ever only need to be a single pass. I could add an ASSERT(delta.tv_usec >= 0) after the if.
Jer Noble
Comment 18 2011-11-03 11:05:25 PDT
Note You need to log in before you can comment on or make changes to this bug.