Bug 110930

Summary: [chromium] Events can't be triggered on MediaStreamTrack
Product: WebKit Reporter: Li Yin <li.yin>
Component: WebCore Misc.Assignee: Li Yin <li.yin>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric.carlson, feature-media-reviews, haraken, hta, jer.noble, jochen, tommyw, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Li Yin
Reported 2013-02-26 17:05:07 PST
When MediaStreamTrack.enabled is changed, event handler can't be triggered in the browser. The same problem is also occurred when LocalMediaStream.stop is called.
Attachments
Patch (2.97 KB, patch)
2013-02-26 17:58 PST, Li Yin
no flags
Patch (5.64 KB, patch)
2013-02-27 01:02 PST, Li Yin
no flags
Patch (4.05 KB, patch)
2013-02-28 05:40 PST, Li Yin
no flags
Li Yin
Comment 1 2013-02-26 17:58:40 PST
Kentaro Hara
Comment 2 2013-02-27 00:21:29 PST
Comment on attachment 190405 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190405&action=review > Source/WebCore/ChangeLog:10 > + When MediaStreamTrack.enabled is changed, event handler can't be triggered > + in the browser.The same problem is also occurred when LocalMediaStream.stop > + is called. Would you also add a spec link here? > Source/WebCore/ChangeLog:14 > + No new tests because the followed tests have covered it already. > + fast/mediastream/MediaStreamTrack.html > + fast/mediastream/LocalMediaStream-onended.html I expected some change in these test results, because the patch is changing the behavior. Why no changes in test results?
Tommy Widenflycht
Comment 3 2013-02-27 00:34:10 PST
Comment on attachment 190405 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190405&action=review > Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp:80 > + component->source()->setReadyState(MediaStreamSource::ReadyStateLive); This is the wrong behaviour completely. A track has two things which decides if media flows through it: 1) If its underlying source is live or not and 2) if the tracks enables state is true or not. This patch connects these two states into one which is very wrong.
Li Yin
Comment 5 2013-02-27 00:50:30 PST
Comment on attachment 190405 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190405&action=review >> Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp:80 >> + component->source()->setReadyState(MediaStreamSource::ReadyStateLive); > > This is the wrong behaviour completely. > > A track has two things which decides if media flows through it: > > 1) If its underlying source is live or not > and > 2) if the tracks enables state is true or not. > > This patch connects these two states into one which is very wrong. DumpRenderTree does it like this as well. I will delete the related implementations in DumpRenderTree.(Such as function didEnableMediaStreamTrack in MockWebMediaStreamCenter.cpp) And the state of component has been checked already in MediaStreamTeack.cpp. Do you think it is necessary to check the state of source?
Li Yin
Comment 6 2013-02-27 01:02:17 PST
Tommy Widenflycht
Comment 7 2013-02-27 01:14:48 PST
What I am saying is that your patch is wrong according to the standard. Unfortunately for technical reasons we have not been able to make DumpRenderTree behave like a proper client. Today the DRT mocks are there just so that as much as possible of the code can be tested. We'll get to that later when chromium switches to content_shell instead of DRT; then we'll start to use as much of the real code as possible. Maybe even doing the full monty and using a local server like WebSockets. But for now DRT and some LayoutTests are just there for exercising WebKit.
Li Yin
Comment 8 2013-02-27 03:38:54 PST
(In reply to comment #7) > What I am saying is that your patch is wrong according to the standard. > > Unfortunately for technical reasons we have not been able to make DumpRenderTree behave like a proper client. Today the DRT mocks are there just so that as much as possible of the code can be tested. > > We'll get to that later when chromium switches to content_shell instead of DRT; then we'll start to use as much of the real code as possible. Maybe even doing the full monty and using a local server like WebSockets. But for now DRT and some LayoutTests are just there for exercising WebKit. If that is true, when onmute, onunmue, onended event handle will be triggered?
Tommy Widenflycht
Comment 9 2013-02-27 03:45:45 PST
(In reply to comment #8) > > If that is true, when onmute, onunmue, onended event handle will be triggered? We are working on it but no ETA yet.
Li Yin
Comment 10 2013-02-27 04:21:49 PST
(In reply to comment #9) > (In reply to comment #8) > > > > If that is true, when onmute, onunmue, onended event handle will be triggered? > > We are working on it but no ETA yet. It isn't introduced in the Spec, and could you please give some clarifications why the tests MediaStreamTrack.html and LocalMediaStream-onended.html are not reasonbable?
Tommy Widenflycht
Comment 11 2013-02-27 05:32:57 PST
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #8) > > > > > > If that is true, when onmute, onunmue, onended event handle will be triggered? > > > > We are working on it but no ETA yet. > > It isn't introduced in the Spec, and could you please give some clarifications why the tests MediaStreamTrack.html and LocalMediaStream-onended.html are not reasonbable? Don't really understand what you are mean. First here's some snippets from the spec that explicitly states that the behavior you added in this patch is wrong, please carefully read the description for the live state: "When a MediaStreamTrack object is created, its readyState is either live or muted, depending on the state of the track’s underlying media source. For example, a track in a LocalMediaStream, created with getUserMedia(), must initially have its readyState attribute set to live." MediaStreamTrack::readyState: "live: The track is active (the track’s underlying media source is making a best-effort attempt to provide data in real time). The output of a track in the live state can be switched on and off with the enabled attribute." "muted: The track is muted (the track’s underlying media source is temporarily unable to provide data)." "ended: The track has ended (the track’s underlying media source is no longer providing data, and will never provide more data for this track)." Secondly when I said that we are working on it I mean that the WebRTC team in chrome is working on enabling the MediaStreamTrack readyState for the chrome browser. Thirdly not all LayoutTests are "wrong" in the sense that they don't implement realistic use cases; but if the choice have been between "not testable" and "unrealistic usage but properly exercises the API" we have chosen the latter for the time being.
Tommy Widenflycht
Comment 12 2013-02-27 05:34:43 PST
(In reply to comment #11) > Don't really understand what you are mean. > Sorry, I meant to write "Don't really understand what you mean."
Li Yin
Comment 13 2013-02-27 23:38:32 PST
(In reply to comment #11) > "ended: The track has ended (the track’s underlying media source is no longer providing data, and will never provide more data for this track)." Thanks for your detailed clarification. You are right, MediaStreamTrack.enable can't control the readyState is "mute" or "unmute", I had a wrong understanding. Thanks for your correcting. And from the 4.7 Event summary chapter of spec, ended event handler should be triggered, when stop() is called. If that is true, the modification in my patch about MediaStreamCenterChromium::didStopLocalMediaStream should be correct. Do you think so?
Tommy Widenflycht
Comment 14 2013-02-28 04:27:57 PST
(In reply to comment #13) > And from the 4.7 Event summary chapter of spec, ended event handler should be triggered, when stop() is called. > If that is true, the modification in my patch about MediaStreamCenterChromium::didStopLocalMediaStream should be correct. > > Do you think so? Yeah, this does seem right. Since the LocalMediaStream has a strong reference to its sources all tracks based on these sources should be ended: "The concept with strong and weak references to media sources allows the web application to derive new MediaStream objects from LocalMediaStream objects (created via getUserMedia()) and still be able to revoke all given permissions with LocalMediaStream.stop()." Feel free to update the patch to just include this and please add a link to the standard in the change log. http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack
Li Yin
Comment 15 2013-02-28 05:40:53 PST
Li Yin
Comment 16 2013-02-28 05:43:14 PST
(In reply to comment #14) > (In reply to comment #13) > Feel free to update the patch to just include this and please add a link to the standard in the change log. > http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack Thanks for your comments. The patch has been updated, please have a look again.
Tommy Widenflycht
Comment 17 2013-02-28 05:47:23 PST
Comment on attachment 190711 [details] Patch LGTM but I am not an reviewer so you need someone to give you the R+. Thanks for working with me to improve the code!
Li Yin
Comment 18 2013-02-28 06:05:11 PST
(In reply to comment #2) > (From update of attachment 190405 [details]) > Would you also add a spec link here? Done. > I expected some change in these test results, because the patch is changing the behavior. Why no changes in test results? For ended event, DRT and Browser used different code path, DRT did the correct thing, ended event was triggered when stop was called. I changed browser code, let its behavior be correct like what DRT is doing.
Li Yin
Comment 19 2013-02-28 17:01:31 PST
Hi Kentaro, Could you please review the patch? Thanks in advance.
Kentaro Hara
Comment 20 2013-02-28 19:10:17 PST
Comment on attachment 190711 [details] Patch r+ing based on tommy's LGTM.
WebKit Review Bot
Comment 21 2013-02-28 20:39:52 PST
Comment on attachment 190711 [details] Patch Clearing flags on attachment: 190711 Committed r144410: <http://trac.webkit.org/changeset/144410>
WebKit Review Bot
Comment 22 2013-02-28 20:39:57 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.