Revert "Don't trigger end of track when starting a new disabled track"

This reverts commit 447c696aaf19064a79d7bc894ce4a0aa3422c69c.

Reason for revert: Introduces a regression. See https://crbug.com/813243

Original change's description:
> Don't trigger end of track when starting a new disabled track
>
> Fix reporting a size of 2x2 on the video element during the loading
> phase.
>
> Bug: 684288
> Change-Id: Id4adceefaf4c3df57a1ba41fd285862d72792b1a
> Reviewed-on: https://chromium-review.googlesource.com/806215
> Commit-Queue: Florent Castelli <orphis@chromium.org>
> Commit-Queue: Guido Urdaneta <guidou@chromium.org>
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#523152}

TBR=guidou@chromium.org, orphis@chromium.org


(cherry picked from commit d1f07e92571d6a2db9ee116c267c2963f7b091ba)

Bug: 684288, 813243
Change-Id: I60bc092c23d1840a9c7e95b4b1d8d02c52c6fb46
Reviewed-on: https://chromium-review.googlesource.com/924190
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#537675}
Reviewed-on: https://chromium-review.googlesource.com/928768
Cr-Commit-Position: refs/branch-heads/3325@{#547}
Cr-Branched-From: bc084a8b5afa3744a74927344e304c02ae54189f-refs/heads/master@{#530369}
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
index be18d3c..6b4f0a6d 100644
--- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
+++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -796,13 +796,6 @@
   ExecuteJavascriptAndWaitForOk("concurrentGetUserMediaStop()");
 }
 
-IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, DisabledTrackVideoSize) {
-  ASSERT_TRUE(embedded_test_server()->Start());
-  GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
-  NavigateToURL(shell(), url);
-  ExecuteJavascriptAndWaitForOk("disabledTrackVideoSize()");
-}
-
 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
                        GetUserMediaAfterStopElementCapture) {
   ASSERT_TRUE(embedded_test_server()->Start());
diff --git a/content/renderer/media/media_stream_video_renderer_sink.cc b/content/renderer/media/media_stream_video_renderer_sink.cc
index b517079..cefaec1 100644
--- a/content/renderer/media/media_stream_video_renderer_sink.cc
+++ b/content/renderer/media/media_stream_video_renderer_sink.cc
@@ -200,7 +200,8 @@
       true);
 
   if (video_track_.Source().GetReadyState() ==
-      blink::WebMediaStreamSource::kReadyStateEnded) {
+          blink::WebMediaStreamSource::kReadyStateEnded ||
+      !video_track_.IsEnabled()) {
     io_task_runner_->PostTask(
         FROM_HERE, base::BindOnce(&FrameDeliverer::RenderEndOfStream,
                                   base::Unretained(frame_deliverer_.get())));
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
index 65be24b..f70d71fb 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -796,24 +796,6 @@
     }
   }
 
-  function disabledTrackVideoSize() {
-    var videoElement = $('local-view-1');
-    navigator.mediaDevices.getUserMedia({
-      audio: true,
-      video: { width: { exact: 320 }, height: { exact: 240 }}
-    }).then(stream => {
-      stream.getVideoTracks()[0].enabled = false;
-
-      videoElement.onloadedmetadata = () => {
-        assertEquals(320, videoElement.videoWidth);
-        assertEquals(240, videoElement.videoHeight);
-        reportTestSuccess();
-      };
-
-      videoElement.srcObject = stream;
-    }).catch(failTest);
-  }
-
   function getUserMediaAfterStopCanvasCapture() {
     var canvas = document.createElement('canvas');
     canvas.width = canvas.height = 64;