[tor-bugs] #5578 [Flashproxy]: Investigate WebRTC for flash proxy NAT punching

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Nov 13 18:05:52 UTC 2014


#5578: Investigate WebRTC for flash proxy NAT punching
----------------------------+-----------------
     Reporter:  dcf         |      Owner:  dcf
         Type:  task        |     Status:  new
     Priority:  normal      |  Milestone:
    Component:  Flashproxy  |    Version:
   Resolution:              |   Keywords:
Actual Points:              |  Parent ID:
       Points:              |
----------------------------+-----------------

Comment (by dcf):

 cjb, I had trouble applying your patch to the Native Code Package. It
 looks like the surrounding code has changed. I tried making some simple
 changes but wasn't entirely successful. Can you help?

 Here's what I did.

 http://www.webrtc.org/reference/getting-started
 http://www.webrtc.org/reference/getting-started/prerequisite-sw
 {{{
 $ sudo apt-get install g++ python libnss3-dev libasound2-dev libpulse-dev
 libjpeg62-turbo-dev libxv-dev libgtk2.0-dev libexpat1-dev openjdk-7-jdk
 libxss-dev libudev-dev libpci-dev
 }}}
 https://sites.google.com/a/chromium.org/dev/developers/how-tos/depottools
 https://sites.google.com/a/chromium.org/dev/developers/how-tos/install-
 depot-tools
 {{{
 $ git clone
 https://chromium.googlesource.com/chromium/tools/depot_tools.git
 $ export PATH=$PWD/depot_tools:$PATH
 }}}
 {{{
 $ mkdir webrtc
 $ cd webrtc
 $ gclient config --name src http://webrtc.googlecode.com/svn/trunk
 $ gclient sync --force
 $ cd src
 $ ninja -C out/Debug
 }}}
 {{{
 $ wget http://printf.net/webrtc-cmd.patch
 $ patch -p1 < webrtc-cmd.patch
 $ gclient sync
 $ ninja -C out/Debug
 }}}

 The first error I get is something about json.h:
 {{{
 ../../talk/examples/peerconnection/webrtc_cmd.cc:36:10: fatal error:
 'talk/base/json.h' file not found
 #include "talk/base/json.h"
          ^
 1 error generated.
 [4/19] LINK video_engine_core_unittests
 ninja: build stopped: subcommand failed.
 }}}
 So I change it an other headers from talk/base to webrtc/base, which seems
 to work. After that I get some errors about the talk_base namespace, which
 seems to have changed to rtc:
 {{{
 ../../talk/examples/peerconnection/webrtc_cmd.cc:43:7: error: use of
 undeclared identifier 'talk_base'
 using talk_base::scoped_ptr;
       ^
 ../../talk/examples/peerconnection/webrtc_cmd.cc:44:7: error: use of
 undeclared identifier 'talk_base'
 using talk_base::scoped_refptr;
       ^
 ../../talk/examples/peerconnection/webrtc_cmd.cc:85:3: error: use of
 undeclared identifier 'talk_base'
   talk_base::scoped_refptr<webrtc::DataChannelInterface> channel_;
   ^
 ../../talk/examples/peerconnection/webrtc_cmd.cc:85:27: error: expected
 member name or ';' after declaration specifiers
   talk_base::scoped_refptr<webrtc::DataChannelInterface> channel_;
   ~~~~~~~~~~~~~~~~~~~~~~~~^
 }}}
 After fixing that, I get an API error, and I'm out of my depth:
 {{{
 ../../talk/examples/peerconnection/webrtc_cmd.cc:179:40: error: too many
 arguments to function call, expected single argument 'stream', have 2
 arguments
   peer_connection_->AddStream(stream_, &constraints_);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~          ^~~~~~~~~~~~~
 ../../talk/app/webrtc/peerconnectioninterface.h:258:3: note: 'AddStream'
 declared here
   virtual bool AddStream(MediaStreamInterface* stream) = 0;
   ^
 }}}

 Here's the full diff of the changes I made to webrtc_cmd.cc:
 {{{
 --- webrtc_cmd.cc.orig  2014-11-13 09:51:49.253103179 -0800
 +++ webrtc_cmd.cc       2014-11-13 10:03:38.616560815 -0800
 @@ -33,15 +33,15 @@
  #include "talk/app/webrtc/datachannelinterface.h"
  #include "talk/app/webrtc/test/fakeconstraints.h"
  #include "talk/app/webrtc/test/mockpeerconnectionobservers.h"
 -#include "talk/base/json.h"
 -#include "talk/base/logging.h"
 -#include "talk/base/ssladapter.h"
 -#include "talk/base/sslstreamadapter.h"
 -#include "talk/base/thread.h"
 +#include "webrtc/base/json.h"
 +#include "webrtc/base/logging.h"
 +#include "webrtc/base/ssladapter.h"
 +#include "webrtc/base/sslstreamadapter.h"
 +#include "webrtc/base/thread.h"
  #include "talk/app/webrtc/test/fakedtlsidentityservice.h"

 -using talk_base::scoped_ptr;
 -using talk_base::scoped_refptr;
 +using rtc::scoped_ptr;
 +using rtc::scoped_refptr;
  using webrtc::MediaStreamInterface;
  using webrtc::CreatePeerConnectionFactory;
  using webrtc::DataChannelInterface;
 @@ -82,7 +82,7 @@
    bool IsOpen() const { return state_ == DataChannelInterface::kOpen; }

   private:
 -  talk_base::scoped_refptr<webrtc::DataChannelInterface> channel_;
 +  rtc::scoped_refptr<webrtc::DataChannelInterface> channel_;
    DataChannelInterface::DataState state_;
  };

 @@ -91,7 +91,7 @@
   public:
    static DummySetSessionDescriptionObserver* Create() {
      return
 -        new
 talk_base::RefCountedObject<DummySetSessionDescriptionObserver>();
 +        new rtc::RefCountedObject<DummySetSessionDescriptionObserver>();
    }
    virtual void OnSuccess() {
      LOG(INFO) << __FUNCTION__;
 @@ -145,15 +145,15 @@
    virtual int AddRef() { return 1; }
    virtual int Release() { return 0; }
   private:
 -  talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
 +  rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
        peer_connection_factory_;
    webrtc::PeerConnectionInterface::IceServers servers_;
    webrtc::PeerConnectionInterface::IceServer server_;
    webrtc::FakeConstraints constraints_;
 -  talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
 peer_connection_;
 -  talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track_;
 -  talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_;
 -  talk_base::scoped_refptr<webrtc::DataChannelInterface> data_channel_;
 +  rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
 +  rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track_;
 +  rtc::scoped_refptr<webrtc::MediaStreamInterface> stream_;
 +  rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel_;
  };

  const char kStunServerUri[] = "stun:stun.l.google.com:19302";
 @@ -170,7 +170,7 @@
  }

  bool WebRtcConnectionManager::InitConnection() {
 -  FakeIdentityService* dtls_service =
 talk_base::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeIdentityService() :
 NULL;
 +  FakeIdentityService* dtls_service =
 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeIdentityService() : NULL;
    peer_connection_ =
 peer_connection_factory_->CreatePeerConnection(servers_,        NULL,
 NULL, dtls_service, this);
    audio_track_ = peer_connection_factory_->CreateAudioTrack(kAudioLabel,
                                                              NULL);
 @@ -264,7 +264,7 @@
  int main(int argc, char **argv) {
    WebRtcConnectionManager manager;

 -  talk_base::InitializeSSL(NULL);
 +  rtc::InitializeSSL(NULL);

    while (1) {
      std::string input;
 @@ -314,7 +314,7 @@
        }
      }
    }
 -  talk_base::CleanupSSL();
 +  rtc::CleanupSSL();
    return 0;
  }

 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5578#comment:35>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list