diff --git a/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java b/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java index 5d14ee51c1..542609d6c9 100644 --- a/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java +++ b/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java @@ -57,8 +57,9 @@ public class PeerConnectionTest extends TestCase { private final String name; private int expectedIceCandidates = 0; private int expectedErrors = 0; - private LinkedList expectedSetSizeDimensions = - new LinkedList(); // Alternating width/height. + private int expectedSetSize = 0; + private int previouslySeenWidth = 0; + private int previouslySeenHeight = 0; private int expectedFramesDelivered = 0; private LinkedList expectedSignalingChanges = new LinkedList(); @@ -116,21 +117,30 @@ public class PeerConnectionTest extends TestCase { assertTrue(--expectedErrors >= 0); } - public synchronized void expectSetSize(int width, int height) { + public synchronized void expectSetSize() { if (RENDER_TO_GUI) { // When new frames are delivered to the GUI renderer we don't get // notified of frame size info. return; } - expectedSetSizeDimensions.add(width); - expectedSetSizeDimensions.add(height); + ++expectedSetSize; } @Override public synchronized void setSize(int width, int height) { assertFalse(RENDER_TO_GUI); - assertEquals(width, expectedSetSizeDimensions.removeFirst().intValue()); - assertEquals(height, expectedSetSizeDimensions.removeFirst().intValue()); + assertTrue(--expectedSetSize >= 0); + // Because different camera devices (fake & physical) produce different + // resolutions, we only sanity-check the set sizes, + assertTrue(width > 0); + assertTrue(height > 0); + if (previouslySeenWidth > 0) { + assertEquals(previouslySeenWidth, width); + assertEquals(previouslySeenHeight, height); + } else { + previouslySeenWidth = width; + previouslySeenHeight = height; + } } public synchronized void expectFramesDelivered(int count) { @@ -292,9 +302,8 @@ public class PeerConnectionTest extends TestCase { stillWaitingForExpectations.add( "expectedRemoveStreamLabels: " + expectedRemoveStreamLabels.size()); } - if (!expectedSetSizeDimensions.isEmpty()) { - stillWaitingForExpectations.add( - "expectedSetSizeDimensions: " + expectedSetSizeDimensions.size()); + if (expectedSetSize != 0) { + stillWaitingForExpectations.add("expectedSetSize"); } if (expectedFramesDelivered > 0) { stillWaitingForExpectations.add( @@ -506,7 +515,7 @@ public class PeerConnectionTest extends TestCase { // serialized SDP, because the C++ API doesn't auto-translate. // Drop |label| params from {Audio,Video}Track-related APIs once // https://code.google.com/p/webrtc/issues/detail?id=1253 is fixed. - offeringExpectations.expectSetSize(640, 480); + offeringExpectations.expectSetSize(); WeakReference oLMS = addTracksToPC( factory, offeringPC, videoSource, "oLMS", "oLMSv0", "oLMSa0", offeringExpectations); @@ -532,7 +541,7 @@ public class PeerConnectionTest extends TestCase { assertTrue(sdpLatch.await()); assertNull(sdpLatch.getSdp()); - answeringExpectations.expectSetSize(640, 480); + answeringExpectations.expectSetSize(); WeakReference aLMS = addTracksToPC( factory, answeringPC, videoSource, "aLMS", "aLMSv0", "aLMSa0", answeringExpectations); @@ -581,8 +590,8 @@ public class PeerConnectionTest extends TestCase { // chosen arbitrarily). offeringExpectations.expectFramesDelivered(10); answeringExpectations.expectFramesDelivered(10); - offeringExpectations.expectSetSize(640, 480); - answeringExpectations.expectSetSize(640, 480); + offeringExpectations.expectSetSize(); + answeringExpectations.expectSetSize(); } offeringExpectations.expectIceConnectionChange( diff --git a/webrtc/modules/video_capture/linux/device_info_linux.cc b/webrtc/modules/video_capture/linux/device_info_linux.cc index d94a838e21..511778d926 100644 --- a/webrtc/modules/video_capture/linux/device_info_linux.cc +++ b/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -294,6 +294,10 @@ int32_t DeviceInfoLinux::FillCapabilityMap(int fd) { cap->rawType = kVideoYUY2; } + else if (videoFormats[fmts] == V4L2_PIX_FMT_YUV420) + { + cap->rawType = kVideoI420; + } else if (videoFormats[fmts] == V4L2_PIX_FMT_MJPEG) { cap->rawType = kVideoMJPEG;