RESOLVED FIXED122358
Create MediaStream object with ended attribute set if all tracks that are being used on its creation are ended
https://bugs.webkit.org/show_bug.cgi?id=122358
Summary Create MediaStream object with ended attribute set if all tracks that are bei...
Thiago de Barros Lacerda
Reported 2013-10-04 16:29:20 PDT
Spec tells that if all tracks that belongs to a new MediaStream object being created are ended, then the ended attribute of this MediaStream must be set to true. http://www.w3.org/TR/mediacapture-streams/#widl-MediaStream-ended
Attachments
Patch (13.12 KB, patch)
2013-10-10 07:48 PDT, Thiago de Barros Lacerda
no flags
Patch (13.11 KB, patch)
2013-10-10 13:03 PDT, Thiago de Barros Lacerda
no flags
Patch (13.12 KB, patch)
2013-10-10 13:21 PDT, Thiago de Barros Lacerda
no flags
Patch (13.12 KB, patch)
2013-10-10 13:27 PDT, Thiago de Barros Lacerda
no flags
Patch (13.43 KB, patch)
2013-10-10 15:39 PDT, Thiago de Barros Lacerda
no flags
Thiago de Barros Lacerda
Comment 1 2013-10-10 07:48:15 PDT
Thiago de Barros Lacerda
Comment 2 2013-10-10 13:03:39 PDT
Thiago de Barros Lacerda
Comment 3 2013-10-10 13:21:50 PDT
Thiago de Barros Lacerda
Comment 4 2013-10-10 13:27:08 PDT
Jer Noble
Comment 5 2013-10-10 14:11:45 PDT
Comment on attachment 213921 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213921&action=review A few nits: > Source/WebCore/Modules/mediastream/MediaStream.cpp:104 > - for (size_t i = 0; i < tracks.size(); ++i) > + bool ended = true; > + for (size_t i = 0; i < tracks.size(); ++i) { > + ended &= tracks[i]->ended(); > processTrack(tracks[i].get(), tracks[i]->kind() == "audio" ? audioSources : videoSources); > + } > > - return createFromSourceVectors(context, audioSources, videoSources); > + return createFromSourceVectors(context, audioSources, videoSources, ended); Nit: I would have named this "allEnded" just to make clear what you're doing with this variable. > Source/WebCore/platform/mediastream/MediaStreamDescriptor.h:55 > - static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); > + static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources, bool ended); I don't particularly like adding new "bool" parameters to creation functions. It's hard to figure out what that true or false parameter means from the a call site. The preferred way to do this is with an enum: enum EndedAtCreationFlags { IsNotEnded, IsEnded }; static PassRefPtr<MediaStream> createFromSourceVectors(ScriptExecutionContext* context, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources, EndedAtCreationFlags flags) Then the EndedAtCreationFlags type would be used elsewhere where this method (or similar ones) are called. > Source/WebCore/platform/mock/MockMediaStreamCenter.cpp:236 > - client->didCreateStream(MediaStreamDescriptor::create(audioSources, videoSources)); > + client->didCreateStream(MediaStreamDescriptor::create(audioSources, videoSources, false)); ...Then this line becomes much more understandable: client->didCreateStream(MediaStreamDescriptor::create(audioSources, videoSources, MediaStreamDescriptor::IsNotEnded)); There are a few examples like this in HTMLMediaElement.h
Thiago de Barros Lacerda
Comment 6 2013-10-10 15:39:32 PDT
Thiago de Barros Lacerda
Comment 7 2013-10-10 15:40:28 PDT
Adding Enum on MediaStreamDescriptor create method
Jer Noble
Comment 8 2013-10-10 15:42:53 PDT
Comment on attachment 213936 [details] Patch Looks good! r=me.
WebKit Commit Bot
Comment 9 2013-10-10 16:15:47 PDT
Comment on attachment 213936 [details] Patch Clearing flags on attachment: 213936 Committed r157268: <http://trac.webkit.org/changeset/157268>
WebKit Commit Bot
Comment 10 2013-10-10 16:15:50 PDT
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.