Bug 202921

Summary: [GStreamer] Refactor track handling to use stream-ids in playbin3 mode
Product: WebKit Reporter: Alicia Boya García <aboya>
Component: WebKitGTKAssignee: Alicia Boya García <aboya>
Status: RESOLVED WONTFIX    
Severity: Normal CC: bugs-noreply, calvaris, cgarcia, eric.carlson, ews-watchlist, glenn, gustavo, jer.noble, menard, philipj, pnormand, sergio, vjaquez
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch calvaris: review+, calvaris: commit-queue-

Description Alicia Boya García 2019-10-14 03:38:06 PDT
Currently the player private uses track indexes to select tracks in
all cases. While using track indices is OK in playbin2, it shouldn't
be done in playbin3, where tracks are identified with string
stream-ids instead.

This patch reworks the track handling to use the right method for each
playbin.
Comment 1 Alicia Boya García 2019-10-14 03:40:10 PDT
Created attachment 380870 [details]
Patch
Comment 2 Alicia Boya García 2019-10-14 04:30:42 PDT
Created attachment 380876 [details]
Patch
Comment 3 Xabier Rodríguez Calvar 2019-10-15 07:31:14 PDT
Comment on attachment 380876 [details]
Patch

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

> Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:96
> +    else if (enabled) // playbin2: support for exactly one track of each kind.
>          m_player->enableTrack(TrackPrivateBaseGStreamer::TrackType::Audio, m_index);

Not a strong opinion but for coherence with the pb3 function that asserts on it, here I would do something like:

I'd do something like:
else {
    ASSERT(m_isLegacyPlaybin);
    if (enabled)
...

> Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:95
> +    else if (selected) // playbin2: support for exactly one track of each kind.
> +        m_player->enableTrack(TrackPrivateBaseGStreamer::TrackType::Audio, m_index);

Ditto
Comment 4 Xabier Rodríguez Calvar 2019-10-15 07:32:45 PDT
Comment on attachment 380876 [details]
Patch

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

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:779
> +    ASSERT(!m_isLegacyPlaybin);

ASSERT(isMainThread()) cause m_selectedStreamIds is not thread safe.
Comment 5 Alicia Boya García 2019-10-17 00:20:27 PDT
I'm deferring this patch because I think it needs more changes.
Comment 6 Philippe Normand 2019-10-17 00:44:08 PDT
Can the bug remains open though?
Comment 7 Alicia Boya García 2019-10-17 04:57:21 PDT
(In reply to Philippe Normand from comment #6)
> Can the bug remains open though?

That's fine.
Comment 8 Philippe Normand 2020-05-13 04:59:35 PDT
So what happens here now? Is this a duplicate of bug 211623 ?
Comment 9 Alicia Boya García 2020-05-14 01:06:22 PDT
(In reply to Philippe Normand from comment #8)
> So what happens here now? Is this a duplicate of bug 211623 ?

Bug 211623 obsoletes this. This patch assumed we wanted to get rid of track ids completely to allow for tracks to change dynamically, taking MSE as a case where that would occur. This is no longer the goal: I found dynamically adding and removing tracks, as opposed to emitting them all in one go, is not stable enough in playbin3, nor necessary for a working MSE implementation. Removed that requirement, there is no benefit from removing track indices.