Fix RTCAudioDeviceModule tests.
This CL enables tests that were previously disabled and fixes the issues that made them flaky. Bug: webrtc:6889, webrtc:7888 Change-Id: I914b59200d7bf2973e8993b04de867cc3355b8a8 Reviewed-on: https://webrtc-review.googlesource.com/98381 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24930}
This commit is contained in:
committed by
Commit Bot
parent
2837edce99
commit
db543c901f
@ -159,6 +159,8 @@
|
|||||||
delegate:delegate];
|
delegate:delegate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Cases
|
||||||
|
|
||||||
// Tests that an ICE connection is established between two ARDAppClient objects
|
// Tests that an ICE connection is established between two ARDAppClient objects
|
||||||
// where one is set up as a caller and the other the answerer. Network
|
// where one is set up as a caller and the other the answerer. Network
|
||||||
// components are mocked out and messages are relayed directly from object to
|
// components are mocked out and messages are relayed directly from object to
|
||||||
@ -176,9 +178,9 @@
|
|||||||
NSString *answererId = @"testAnswererId";
|
NSString *answererId = @"testAnswererId";
|
||||||
|
|
||||||
XCTestExpectation *callerConnectionExpectation =
|
XCTestExpectation *callerConnectionExpectation =
|
||||||
[self expectationWithDescription:@"Caller PC connected."];
|
[self expectationWithDescription:@"Caller PC connected"];
|
||||||
XCTestExpectation *answererConnectionExpectation =
|
XCTestExpectation *answererConnectionExpectation =
|
||||||
[self expectationWithDescription:@"Answerer PC connected."];
|
[self expectationWithDescription:@"Answerer PC connected"];
|
||||||
|
|
||||||
caller = [self createAppClientForRoomId:roomId
|
caller = [self createAppClientForRoomId:roomId
|
||||||
clientId:callerId
|
clientId:callerId
|
||||||
|
|||||||
@ -203,8 +203,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
|
|
||||||
// Tests that playout can be initiated, started and stopped. No audio callback
|
// Tests that playout can be initiated, started and stopped. No audio callback
|
||||||
// is registered in this test.
|
// is registered in this test.
|
||||||
// Failing when running on real iOS devices: bugs.webrtc.org/6889.
|
- (void)testStartStopPlayout {
|
||||||
- (void)DISABLED_testStartStopPlayout {
|
|
||||||
[self startPlayout];
|
[self startPlayout];
|
||||||
[self stopPlayout];
|
[self stopPlayout];
|
||||||
[self startPlayout];
|
[self startPlayout];
|
||||||
@ -213,8 +212,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
|
|
||||||
// Tests that recording can be initiated, started and stopped. No audio callback
|
// Tests that recording can be initiated, started and stopped. No audio callback
|
||||||
// is registered in this test.
|
// is registered in this test.
|
||||||
// Can sometimes fail when running on real devices: bugs.webrtc.org/7888.
|
- (void)testStartStopRecording {
|
||||||
- (void)DISABLED_testStartStopRecording {
|
|
||||||
[self startRecording];
|
[self startRecording];
|
||||||
[self stopRecording];
|
[self stopRecording];
|
||||||
[self startRecording];
|
[self startRecording];
|
||||||
@ -236,8 +234,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
// last active instance shall deactivate the audio session. The test does not
|
// last active instance shall deactivate the audio session. The test does not
|
||||||
// explicitly verify correct audio session calls but instead focuses on
|
// explicitly verify correct audio session calls but instead focuses on
|
||||||
// ensuring that audio starts for both ADMs.
|
// ensuring that audio starts for both ADMs.
|
||||||
// Failing when running on real iOS devices: bugs.webrtc.org/6889.
|
- (void)testStartPlayoutOnTwoInstances {
|
||||||
- (void)DISABLED_testStartPlayoutOnTwoInstances {
|
|
||||||
// Create and initialize a second/extra ADM instance. The default ADM is
|
// Create and initialize a second/extra ADM instance. The default ADM is
|
||||||
// created by the test harness.
|
// created by the test harness.
|
||||||
rtc::scoped_refptr<webrtc::AudioDeviceModule> secondAudioDeviceModule =
|
rtc::scoped_refptr<webrtc::AudioDeviceModule> secondAudioDeviceModule =
|
||||||
@ -282,7 +279,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
// has been done successfully and that there is no conflict with the already
|
// has been done successfully and that there is no conflict with the already
|
||||||
// playing first ADM.
|
// playing first ADM.
|
||||||
XCTestExpectation *playoutExpectation = [self expectationWithDescription:@"NeedMorePlayoutData"];
|
XCTestExpectation *playoutExpectation = [self expectationWithDescription:@"NeedMorePlayoutData"];
|
||||||
playoutExpectation.expectedFulfillmentCount = kNumCallbacks;
|
__block int num_callbacks = 0;
|
||||||
|
|
||||||
MockAudioTransport mock2;
|
MockAudioTransport mock2;
|
||||||
mock2.expectNeedMorePlayData(^int32_t(const size_t nSamples,
|
mock2.expectNeedMorePlayData(^int32_t(const size_t nSamples,
|
||||||
@ -299,7 +296,9 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
XCTAssertEqual(nChannels, playoutParameters.channels());
|
XCTAssertEqual(nChannels, playoutParameters.channels());
|
||||||
XCTAssertEqual((int) samplesPerSec, playoutParameters.sample_rate());
|
XCTAssertEqual((int) samplesPerSec, playoutParameters.sample_rate());
|
||||||
XCTAssertNotEqual((void*)NULL, audioSamples);
|
XCTAssertNotEqual((void*)NULL, audioSamples);
|
||||||
|
if (++num_callbacks == kNumCallbacks) {
|
||||||
[playoutExpectation fulfill];
|
[playoutExpectation fulfill];
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
@ -308,6 +307,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
XCTAssertEqual(0, secondAudioDeviceModule->StartPlayout());
|
XCTAssertEqual(0, secondAudioDeviceModule->StartPlayout());
|
||||||
XCTAssertTrue(secondAudioDeviceModule->Playing());
|
XCTAssertTrue(secondAudioDeviceModule->Playing());
|
||||||
[self waitForExpectationsWithTimeout:kTestTimeOutInSec handler:nil];
|
[self waitForExpectationsWithTimeout:kTestTimeOutInSec handler:nil];
|
||||||
|
[self stopPlayout];
|
||||||
XCTAssertEqual(0, secondAudioDeviceModule->StopPlayout());
|
XCTAssertEqual(0, secondAudioDeviceModule->StopPlayout());
|
||||||
XCTAssertFalse(secondAudioDeviceModule->Playing());
|
XCTAssertFalse(secondAudioDeviceModule->Playing());
|
||||||
XCTAssertFalse(secondAudioDeviceModule->PlayoutIsInitialized());
|
XCTAssertFalse(secondAudioDeviceModule->PlayoutIsInitialized());
|
||||||
@ -320,8 +320,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
- (void)testStartPlayoutVerifyCallbacks {
|
- (void)testStartPlayoutVerifyCallbacks {
|
||||||
|
|
||||||
XCTestExpectation *playoutExpectation = [self expectationWithDescription:@"NeedMorePlayoutData"];
|
XCTestExpectation *playoutExpectation = [self expectationWithDescription:@"NeedMorePlayoutData"];
|
||||||
playoutExpectation.expectedFulfillmentCount = kNumCallbacks;
|
__block int num_callbacks = 0;
|
||||||
|
|
||||||
mock.expectNeedMorePlayData(^int32_t(const size_t nSamples,
|
mock.expectNeedMorePlayData(^int32_t(const size_t nSamples,
|
||||||
const size_t nBytesPerSample,
|
const size_t nBytesPerSample,
|
||||||
const size_t nChannels,
|
const size_t nChannels,
|
||||||
@ -336,8 +335,9 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
XCTAssertEqual(nChannels, playoutParameters.channels());
|
XCTAssertEqual(nChannels, playoutParameters.channels());
|
||||||
XCTAssertEqual((int) samplesPerSec, playoutParameters.sample_rate());
|
XCTAssertEqual((int) samplesPerSec, playoutParameters.sample_rate());
|
||||||
XCTAssertNotEqual((void*)NULL, audioSamples);
|
XCTAssertNotEqual((void*)NULL, audioSamples);
|
||||||
|
if (++num_callbacks == kNumCallbacks) {
|
||||||
[playoutExpectation fulfill];
|
[playoutExpectation fulfill];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
- (void)testStartRecordingVerifyCallbacks {
|
- (void)testStartRecordingVerifyCallbacks {
|
||||||
XCTestExpectation *recordExpectation =
|
XCTestExpectation *recordExpectation =
|
||||||
[self expectationWithDescription:@"RecordedDataIsAvailable"];
|
[self expectationWithDescription:@"RecordedDataIsAvailable"];
|
||||||
recordExpectation.expectedFulfillmentCount = kNumCallbacks;
|
__block int num_callbacks = 0;
|
||||||
|
|
||||||
mock.expectRecordedDataIsAvailable(^(const void* audioSamples,
|
mock.expectRecordedDataIsAvailable(^(const void* audioSamples,
|
||||||
const size_t nSamples,
|
const size_t nSamples,
|
||||||
@ -373,7 +373,9 @@ static const NSUInteger kNumIgnoreFirstCallbacks = 50;
|
|||||||
XCTAssertEqual(0, clockDrift);
|
XCTAssertEqual(0, clockDrift);
|
||||||
XCTAssertEqual(0u, currentMicLevel);
|
XCTAssertEqual(0u, currentMicLevel);
|
||||||
XCTAssertFalse(keyPressed);
|
XCTAssertFalse(keyPressed);
|
||||||
|
if (++num_callbacks == kNumCallbacks) {
|
||||||
[recordExpectation fulfill];
|
[recordExpectation fulfill];
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user