pRevert 5371 "Revert 5367 "Update talk to 59410372.""

> Revert 5367 "Update talk to 59410372."
> 
> > Update talk to 59410372.
> > 
> > R=jiayl@webrtc.org, wu@webrtc.org
> > 
> > Review URL: https://webrtc-codereview.appspot.com/6929004
> 
> TBR=mallinath@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/6999004

TBR=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7109004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5381 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/media/base/constants.cc b/talk/media/base/constants.cc
index 9162ce4..a8a0da7 100644
--- a/talk/media/base/constants.cc
+++ b/talk/media/base/constants.cc
@@ -78,6 +78,7 @@
 const int kPreferredUseInbandFec = 0;
 
 const char kRtcpFbParamNack[] = "nack";
+const char kRtcpFbNackParamPli[] = "pli";
 const char kRtcpFbParamRemb[] = "goog-remb";
 
 const char kRtcpFbParamCcm[] = "ccm";
diff --git a/talk/media/base/constants.h b/talk/media/base/constants.h
index b80c0fc..5414db5 100644
--- a/talk/media/base/constants.h
+++ b/talk/media/base/constants.h
@@ -89,6 +89,7 @@
 
 // rtcp-fb messages according to RFC 4585
 extern const char kRtcpFbParamNack[];
+extern const char kRtcpFbNackParamPli[];
 // rtcp-fb messages according to
 // http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-00
 extern const char kRtcpFbParamRemb[];
diff --git a/talk/media/base/fakevideorenderer.h b/talk/media/base/fakevideorenderer.h
index 362e592..cab77dd 100644
--- a/talk/media/base/fakevideorenderer.h
+++ b/talk/media/base/fakevideorenderer.h
@@ -48,6 +48,7 @@
   }
 
   virtual bool SetSize(int width, int height, int reserved) {
+    talk_base::CritScope cs(&crit_);
     width_ = width;
     height_ = height;
     ++num_set_sizes_;
@@ -56,6 +57,7 @@
   }
 
   virtual bool RenderFrame(const VideoFrame* frame) {
+    talk_base::CritScope cs(&crit_);
     // TODO(zhurunz) Check with VP8 team to see if we can remove this
     // tolerance on Y values.
     black_frame_ = CheckFrameColorYuv(6, 48, 128, 128, 128, 128, frame);
@@ -79,11 +81,26 @@
   }
 
   int errors() const { return errors_; }
-  int width() const { return width_; }
-  int height() const { return height_; }
-  int num_set_sizes() const { return num_set_sizes_; }
-  int num_rendered_frames() const { return num_rendered_frames_; }
-  bool black_frame() const { return black_frame_; }
+  int width() const {
+    talk_base::CritScope cs(&crit_);
+    return width_;
+  }
+  int height() const {
+    talk_base::CritScope cs(&crit_);
+    return height_;
+  }
+  int num_set_sizes() const {
+    talk_base::CritScope cs(&crit_);
+    return num_set_sizes_;
+  }
+  int num_rendered_frames() const {
+    talk_base::CritScope cs(&crit_);
+    return num_rendered_frames_;
+  }
+  bool black_frame() const {
+    talk_base::CritScope cs(&crit_);
+    return black_frame_;
+  }
 
   sigslot::signal3<int, int, int> SignalSetSize;
   sigslot::signal1<const VideoFrame*> SignalRenderFrame;
@@ -143,6 +160,7 @@
   int num_set_sizes_;
   int num_rendered_frames_;
   bool black_frame_;
+  mutable talk_base::CriticalSection crit_;
 };
 
 }  // namespace cricket
diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h
index 94ae03f..9c74762 100644
--- a/talk/media/base/mediachannel.h
+++ b/talk/media/base/mediachannel.h
@@ -50,10 +50,6 @@
 class Timing;
 }
 
-namespace webrtc {
-struct DataChannelInit;
-}
-
 namespace cricket {
 
 class AudioRenderer;
@@ -1157,11 +1153,6 @@
   // Signal when the media channel is ready to send the stream. Arguments are:
   //     writable(bool)
   sigslot::signal1<bool> SignalReadyToSend;
-  // Signal for notifying when a new stream is added from the remote side. Used
-  // for the in-band negotioation through the OPEN message for SCTP data
-  // channel.
-  sigslot::signal2<const std::string&, const webrtc::DataChannelInit&>
-      SignalNewStreamReceived;
 };
 
 }  // namespace cricket
diff --git a/talk/media/base/videoengine_unittest.h b/talk/media/base/videoengine_unittest.h
index d9266f2..2ffd14b 100644
--- a/talk/media/base/videoengine_unittest.h
+++ b/talk/media/base/videoengine_unittest.h
@@ -893,8 +893,11 @@
     talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer(
       new cricket::FakeVideoCapturer);
     capturer->SetScreencast(true);
-    cricket::VideoFormat format(1024, 768,
-                                cricket::VideoFormat::FpsToInterval(5), 0);
+    const int kTestWidth = 160;
+    const int kTestHeight = 120;
+    cricket::VideoFormat format(kTestWidth, kTestHeight,
+                                cricket::VideoFormat::FpsToInterval(5),
+                                cricket::FOURCC_I420);
     EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format));
     EXPECT_TRUE(channel_->AddSendStream(
         cricket::StreamParams::CreateLegacy(5678)));
@@ -902,8 +905,10 @@
     EXPECT_TRUE(channel_->AddRecvStream(
         cricket::StreamParams::CreateLegacy(5678)));
     EXPECT_TRUE(channel_->SetRenderer(5678, &renderer1));
-    EXPECT_TRUE(capturer->CaptureCustomFrame(1024, 768, cricket::FOURCC_I420));
-    EXPECT_FRAME_ON_RENDERER_WAIT(renderer1, 1, 1024, 768, kTimeout);
+    EXPECT_TRUE(capturer->CaptureCustomFrame(
+        kTestWidth, kTestHeight, cricket::FOURCC_I420));
+    EXPECT_FRAME_ON_RENDERER_WAIT(
+        renderer1, 1, kTestWidth, kTestHeight, kTimeout);
 
     // Get stats, and make sure they are correct for two senders.
     cricket::VideoMediaInfo info;
@@ -917,8 +922,8 @@
     EXPECT_EQ(DefaultCodec().height, info.senders[0].frame_height);
     EXPECT_EQ(1U, info.senders[1].ssrcs().size());
     EXPECT_EQ(5678U, info.senders[1].ssrcs()[0]);
-    EXPECT_EQ(1024, info.senders[1].frame_width);
-    EXPECT_EQ(768, info.senders[1].frame_height);
+    EXPECT_EQ(kTestWidth, info.senders[1].frame_width);
+    EXPECT_EQ(kTestHeight, info.senders[1].frame_height);
     // The capturer must be unregistered here as it runs out of it's scope next.
     EXPECT_TRUE(channel_->SetCapturer(5678, NULL));
   }
@@ -1221,9 +1226,11 @@
 
   // Tests that we can add and remove capturers and frames are sent out properly
   void AddRemoveCapturer() {
-    const cricket::VideoCodec codec(DefaultCodec());
+    cricket::VideoCodec codec = DefaultCodec();
+    codec.width = 320;
+    codec.height = 240;
     const int time_between_send = TimeBetweenSend(codec);
-    EXPECT_TRUE(SetDefaultCodec());
+    EXPECT_TRUE(SetOneCodec(codec));
     EXPECT_TRUE(SetSend(true));
     EXPECT_TRUE(channel_->SetRender(true));
     EXPECT_EQ(0, renderer_.num_rendered_frames());
@@ -1232,8 +1239,9 @@
     talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer(
         new cricket::FakeVideoCapturer);
     capturer->SetScreencast(true);
-    cricket::VideoFormat format(1024, 768,
-                                cricket::VideoFormat::FpsToInterval(30), 0);
+    cricket::VideoFormat format(480, 360,
+                                cricket::VideoFormat::FpsToInterval(30),
+                                cricket::FOURCC_I420);
     EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format));
     // All capturers start generating frames with the same timestamp. ViE does
     // not allow the same timestamp to be used. Capture one frame before
@@ -1305,11 +1313,6 @@
   void AddRemoveCapturerMultipleSources() {
     // WebRTC implementation will drop frames if pushed to quickly. Wait the
     // interval time to avoid that.
-    const cricket::VideoFormat send_format(
-        1024,
-        768,
-        cricket::VideoFormat::FpsToInterval(30),
-        0);
     // WebRTC implementation will drop frames if pushed to quickly. Wait the
     // interval time to avoid that.
     // Set up the stream associated with the engine.
@@ -1352,11 +1355,17 @@
     EXPECT_TRUE(SetSend(true));
     EXPECT_TRUE(channel_->SetRender(true));
     // Test capturer associated with engine.
-    EXPECT_TRUE(capturer1->CaptureCustomFrame(1024, 768, cricket::FOURCC_I420));
-    EXPECT_FRAME_ON_RENDERER_WAIT(renderer1, 1, 1024, 768, kTimeout);
+    const int kTestWidth = 160;
+    const int kTestHeight = 120;
+    EXPECT_TRUE(capturer1->CaptureCustomFrame(
+        kTestWidth, kTestHeight, cricket::FOURCC_I420));
+    EXPECT_FRAME_ON_RENDERER_WAIT(
+        renderer1, 1, kTestWidth, kTestHeight, kTimeout);
     // Capture a frame with additional capturer2, frames should be received
-    EXPECT_TRUE(capturer2->CaptureCustomFrame(1024, 768, cricket::FOURCC_I420));
-    EXPECT_FRAME_ON_RENDERER_WAIT(renderer2, 1, 1024, 768, kTimeout);
+    EXPECT_TRUE(capturer2->CaptureCustomFrame(
+        kTestWidth, kTestHeight, cricket::FOURCC_I420));
+    EXPECT_FRAME_ON_RENDERER_WAIT(
+        renderer2, 1, kTestWidth, kTestHeight, kTimeout);
     // Successfully remove the capturer.
     EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
     // Fail to re-remove the capturer.