Bug 129484 - [WebRTC] Updating createOffer and createAnswer methods to match WebRTC editor's draft of 01/27/2014
Summary: [WebRTC] Updating createOffer and createAnswer methods to match WebRTC editor...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Thiago de Barros Lacerda
URL:
Keywords:
Depends on:
Blocks: 124288
  Show dependency treegraph
 
Reported: 2014-02-28 08:15 PST by Thiago de Barros Lacerda
Modified: 2014-05-19 09:08 PDT (History)
14 users (show)

See Also:


Attachments
Patch (34.77 KB, patch)
2014-02-28 08:22 PST, Thiago de Barros Lacerda
no flags Details | Formatted Diff | Diff
Requested Changes (34.81 KB, patch)
2014-03-06 06:20 PST, Thiago de Barros Lacerda
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago de Barros Lacerda 2014-02-28 08:15:41 PST
According to the spec, createOffer and createAnswer will no longer have MediaConstraints as an argument, instead they will have RTCOfferOptions and RTCOfferAnswerOptions, respectively.
Comment 1 Thiago de Barros Lacerda 2014-02-28 08:22:39 PST
Created attachment 225468 [details]
Patch
Comment 2 Eric Carlson 2014-02-28 11:23:51 PST
Comment on attachment 225468 [details]
Patch

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

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:41
> +        // According to the spec, the error is going to be defined yet, so let's use TYPE_MISMATCH_ERR for now.
> +        ec = TYPE_MISMATCH_ERR;

This should probably have a FIXME with a bug number to help us remember to change this once the error is defined.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:57
> +    if (validateRequestIdentity(requestIdentity))
> +        m_requestIdentity = requestIdentity;
> +
> +    return true;

An invalid request identity does not result in an error?

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:64
> +bool RTCOfferAnswerOptions::validateRequestIdentity(const String& value) const
> +{
> +    return value == "yes" || value == "no" || value == "ifconfigured";
> +}
> +

Unless this is going to be used outside of this class, it doesn't have to be a member function.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:70
> +        // According to the spec, the error is going to be defined yet, so let's use TYPE_MISMATCH_ERR for now.
> +        ec = TYPE_MISMATCH_ERR;

Ditto about adding a FIXME.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:85
> +    String offerToReceiveVideoStr, offerToReceiveAudioStr;

Nit: these declarations should be on separate lines.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:92
> +    if (options.get("offerToReceiveVideo", offerToReceiveVideoStr)) {
> +        m_offerToReceiveVideo = offerToReceiveVideoStr.toInt64Strict(&numberConversionSuccess);
> +        if (!numberConversionSuccess)
> +            return false;
> +    } else
> +        return false;

Nit: I would reverse the order of the comparisons, return false if "offerToReceiveVideo" isn't specified first, to avoid having to indent the number conversion.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:99
> +    if (options.get("offerToReceiveAudio", offerToReceiveAudioStr)) {
> +        m_offerToReceiveAudio = offerToReceiveAudioStr.toInt64Strict(&numberConversionSuccess);
> +        if (!numberConversionSuccess)
> +            return false;
> +    } else
> +        return false;

Ditto.

> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:102
> +    bool iceRestart;

Nit: this can be declared just before it is used.

> Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp:206
> +void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCPeerConnectionErrorCallback> errorCallback, const Dictionary& offerOptions, ExceptionCode& ec)

It doesn't have to be done in this patch, but we should update all of the MEDIA_STREAM code to use Ref<> and PassRef<> instead of RefPtr<> and PassRefPtr<>.

> Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp:67
> +void RTCPeerConnectionHandlerMock::createAnswer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<RTCOfferAnswerOptions> constraints)

This will break the -Werror build because "constraints" is not used.
Comment 3 Thiago de Barros Lacerda 2014-03-06 06:20:01 PST
Created attachment 225984 [details]
Requested Changes
Comment 4 Thiago de Barros Lacerda 2014-03-06 06:25:32 PST
Comment on attachment 225468 [details]
Patch

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

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:41
>> +        ec = TYPE_MISMATCH_ERR;
> 
> This should probably have a FIXME with a bug number to help us remember to change this once the error is defined.

OK

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:57
>> +    return true;
> 
> An invalid request identity does not result in an error?

Spec don't says anything about it and requestIdentity has a default value ("ifconfigured"), so I thought that would be better to just ignore an invalid value and stay with the default one.

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:64
>> +
> 
> Unless this is going to be used outside of this class, it doesn't have to be a member function.

OK, I'll put it as static

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:70
>> +        ec = TYPE_MISMATCH_ERR;
> 
> Ditto about adding a FIXME.

OK

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:85
>> +    String offerToReceiveVideoStr, offerToReceiveAudioStr;
> 
> Nit: these declarations should be on separate lines.

OK

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:92
>> +        return false;
> 
> Nit: I would reverse the order of the comparisons, return false if "offerToReceiveVideo" isn't specified first, to avoid having to indent the number conversion.

OK

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:99
>> +        return false;
> 
> Ditto.

OK

>> Source/WebCore/Modules/mediastream/RTCOfferAnswerOptions.cpp:102
>> +    bool iceRestart;
> 
> Nit: this can be declared just before it is used.

OK

>> Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp:206
>> +void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> successCallback, PassRefPtr<RTCPeerConnectionErrorCallback> errorCallback, const Dictionary& offerOptions, ExceptionCode& ec)
> 
> It doesn't have to be done in this patch, but we should update all of the MEDIA_STREAM code to use Ref<> and PassRef<> instead of RefPtr<> and PassRefPtr<>.

I can do that later

>> Source/WebCore/platform/mock/RTCPeerConnectionHandlerMock.cpp:67
>> +void RTCPeerConnectionHandlerMock::createAnswer(PassRefPtr<RTCSessionDescriptionRequest> request, PassRefPtr<RTCOfferAnswerOptions> constraints)
> 
> This will break the -Werror build because "constraints" is not used.

oops.
Comment 5 WebKit Commit Bot 2014-03-06 15:35:40 PST
Comment on attachment 225984 [details]
Requested Changes

Clearing flags on attachment: 225984

Committed r165226: <http://trac.webkit.org/changeset/165226>
Comment 6 WebKit Commit Bot 2014-03-06 15:35:44 PST
All reviewed patches have been landed.  Closing bug.