Changeset 202339 in webkit


Ignore:
Timestamp:
Jun 22, 2016 11:15:40 AM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: Add support for the negotiationneeded event in MediaEndpointPeerConnection
https://bugs.webkit.org/show_bug.cgi?id=158985

Source/WebCore:

Reviewed by Eric Carlson.

Implement MediaEndpointPeerConnection's isNegotiationNeeded, markAsNeedingNegotiation and
clearNegotiationNeededState functions. The calls to these functions are already up-to-date.

Test: fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html

  • Modules/mediastream/MediaEndpointPeerConnection.cpp:

(WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):

  • Modules/mediastream/MediaEndpointPeerConnection.h:
  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):

LayoutTests:

Add tests for the RTCPeerConnection negotiationneeded event.

Reviewed by Eric Carlson.

  • fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Added.
  • fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html: Added.

Verify that a negotiationneeded event is fired when not all local media can be included in
an answer. (The answerer cannot reply with more m-lines than the offer had to begin with.)

  • fast/mediastream/RTCPeerConnection-onnegotiationneeded-expected.txt:
  • fast/mediastream/RTCPeerConnection-onnegotiationneeded.html:

Verify that a negotiationneeded event is fired when tracks are added and removed from an
RTCPeerConnection.

  • platform/gtk/TestExpectations:

Unskip fast/mediastream/RTCPeerConnection-onnegotiationneeded.html.

  • platform/mac/TestExpectations:

The mac port does not build with WEB_RTC enabled yet.

Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202334 r202339  
     12016-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Add support for the negotiationneeded event in MediaEndpointPeerConnection
     4        https://bugs.webkit.org/show_bug.cgi?id=158985
     5
     6        Add tests for the RTCPeerConnection negotiationneeded event.
     7
     8        Reviewed by Eric Carlson.
     9
     10        * fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Added.
     11        * fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html: Added.
     12        Verify that a negotiationneeded event is fired when not all local media can be included in
     13        an answer. (The answerer cannot reply with more m-lines than the offer had to begin with.)
     14        * fast/mediastream/RTCPeerConnection-onnegotiationneeded-expected.txt:
     15        * fast/mediastream/RTCPeerConnection-onnegotiationneeded.html:
     16        Verify that a negotiationneeded event is fired when tracks are added and removed from an
     17        RTCPeerConnection.
     18        * platform/gtk/TestExpectations:
     19        Unskip fast/mediastream/RTCPeerConnection-onnegotiationneeded.html.
     20        * platform/mac/TestExpectations:
     21        The mac port does not build with WEB_RTC enabled yet.
     22
    1232016-06-22  Youenn Fablet  <youennf@gmail.com>
    224
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-onnegotiationneeded-expected.txt

    r160181 r202339  
    55
    66PASS Got a stream.
    7 PASS onNegotiationNeeded was called.
    8 PASS stream.getAudioTracks().length is 1
    9 PASS stream.getAudioTracks().length is 0
    10 PASS onNegotiationNeeded was called when track was removed.
    11 PASS stream.getAudioTracks().length is 0
    12 PASS stream.getAudioTracks().length is 1
    13 PASS onNegotiationNeeded was called when track was added.
     7PASS onNegotiationNeeded was called when a track was added.
     8PASS onNegotiationNeeded2 was called when a track was removed.
     9PASS onNegotiationNeeded3 was called when a track was added.
    1410PASS successfullyParsed is true
    1511
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-onnegotiationneeded.html

    r164602 r202339  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33    <head>
     
    88            description("Tests RTCPeerConnection onnegotiationneeded.");
    99
    10             var stream = null;
    11             var pc = null;
    12             var track = null;
     10            let stream;
     11            let pc;
     12            let audioSender;
    1313
    1414            function error()
     
    1818            }
    1919
    20             function getUserMedia(dictionary, callback)
    21             {
    22                 try {
    23                     navigator.webkitGetUserMedia(dictionary, callback, error);
    24                 } catch (e) {
    25                     testFailed('webkitGetUserMedia threw exception :' + e);
    26                     finishJSTest();
    27                 }
    28             }
    29 
    3020            function onNegotiationNeeded(event)
    3121            {
    32                 testPassed('onNegotiationNeeded was called.');
     22                testPassed('onNegotiationNeeded was called when a track was added.');
    3323                removeTrack();
    3424            }
     
    3626            function onNegotiationNeeded2(event)
    3727            {
    38                 testPassed('onNegotiationNeeded was called when track was removed.');
     28                testPassed('onNegotiationNeeded2 was called when a track was removed.');
    3929                addTrack();
    4030            }
     
    4232            function onNegotiationNeeded3(event)
    4333            {
    44                 testPassed('onNegotiationNeeded was called when track was added.');
     34                testPassed('onNegotiationNeeded3 was called when a track was added.');
    4535                finishJSTest();
    4636            }
     
    5444                pc.onnegotiationneeded = onNegotiationNeeded;
    5545
    56                 pc.addStream(stream);
     46                audioSender = pc.addTrack(stream.getAudioTracks()[0], stream);
    5747            }
    5848
     
    6050            {
    6151                pc.onnegotiationneeded = onNegotiationNeeded2;
    62                 shouldBe('stream.getAudioTracks().length', '1');
    63                 track = stream.getAudioTracks()[0];
    64                 stream.removeTrack(track);
    65                 shouldBe('stream.getAudioTracks().length', '0');
     52                pc.removeTrack(audioSender);
    6653            }
    6754
     
    6956            {
    7057                pc.onnegotiationneeded = onNegotiationNeeded3;
    71                 shouldBe('stream.getAudioTracks().length', '0');
    72                 stream.addTrack(track);
    73                 shouldBe('stream.getAudioTracks().length', '1');
     58                pc.addTrack(stream.getVideoTracks()[0], stream);
    7459            }
    7560
    76             getUserMedia({audio:true, video:true}, gotStream);
     61            if (window.testRunner)
     62                testRunner.setUserMediaPermission(true);
     63            else {
     64                debug("This test can not be run without the testRunner");
     65                finishJSTest();
     66            }
     67
     68            navigator.mediaDevices.getUserMedia({audio:true, video:true}).then(gotStream).catch(error);
    7769
    7870            window.jsTestIsAsync = true;
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r202220 r202339  
    350350webkit.org/b/79203 fast/mediastream/RTCPeerConnection-ice.html [ Skip ]
    351351webkit.org/b/79203 fast/mediastream/RTCPeerConnection-localDescription.html [ Skip ]
    352 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-onnegotiationneeded.html [ Skip ]
    353352webkit.org/b/79203 fast/mediastream/RTCPeerConnection-remoteDescription.html [ Skip ]
    354353webkit.org/b/79203 fast/mediastream/RTCPeerConnection-stable.html [ Skip ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r202322 r202339  
    190190fast/mediastream/RTCPeerConnection-add-removeTrack.html
    191191fast/mediastream/RTCPeerConnection-addTrack-reuse-sender.html
     192fast/mediastream/RTCPeerConnection-onnegotiationneeded.html
     193fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html
    192194fast/mediastream/RTCPeerConnection-closed-state.html
    193195fast/mediastream/RTCPeerConnection-overloaded-operations-params.html
  • trunk/Source/WebCore/ChangeLog

    r202337 r202339  
     12016-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Add support for the negotiationneeded event in MediaEndpointPeerConnection
     4        https://bugs.webkit.org/show_bug.cgi?id=158985
     5
     6        Reviewed by Eric Carlson.
     7
     8        Implement MediaEndpointPeerConnection's isNegotiationNeeded, markAsNeedingNegotiation and
     9        clearNegotiationNeededState functions. The calls to these functions are already up-to-date.
     10
     11        Test: fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html
     12
     13        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
     14        (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
     15        * Modules/mediastream/MediaEndpointPeerConnection.h:
     16        * Modules/mediastream/RTCPeerConnection.cpp:
     17        (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
     18
    1192016-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
    220
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp

    r202293 r202339  
    722722void MediaEndpointPeerConnection::markAsNeedingNegotiation()
    723723{
    724     notImplemented();
     724    if (m_negotiationNeeded)
     725        return;
     726
     727    m_negotiationNeeded = true;
     728
     729    if (m_client->internalSignalingState() == SignalingState::Stable)
     730        m_client->scheduleNegotiationNeededEvent();
    725731}
    726732
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h

    r202293 r202339  
    7979    void stop() override;
    8080
    81     bool isNegotiationNeeded() const override { return false; };
    82     void markAsNeedingNegotiation() override;
    83     void clearNegotiationNeededState() override { notImplemented(); };
     81    bool isNegotiationNeeded() const override { return m_negotiationNeeded; };
     82    void markAsNeedingNegotiation();
     83    void clearNegotiationNeededState() override { m_negotiationNeeded = false; };
    8484
    8585private:
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r202337 r202339  
    477477    scriptExecutionContext()->postTask([=](ScriptExecutionContext&) {
    478478        if (m_backend->isNegotiationNeeded()) {
     479            m_backend->clearNegotiationNeededState();
    479480            dispatchEvent(Event::create(eventNames().negotiationneededEvent, false, false));
    480             m_backend->clearNegotiationNeededState();
    481481        }
    482482    });
Note: See TracChangeset for help on using the changeset viewer.