| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return [session1.type isEqual:session2.type]; | 83 return [session1.type isEqual:session2.type]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 - (RTCMediaStream*)addTracksToPeerConnection:(RTCPeerConnection*)pc | 86 - (RTCMediaStream*)addTracksToPeerConnection:(RTCPeerConnection*)pc |
| 87 withFactory:(RTCPeerConnectionFactory*)factory | 87 withFactory:(RTCPeerConnectionFactory*)factory |
| 88 videoSource:(RTCVideoSource*)videoSource | 88 videoSource:(RTCVideoSource*)videoSource |
| 89 streamLabel:(NSString*)streamLabel | 89 streamLabel:(NSString*)streamLabel |
| 90 videoTrackID:(NSString*)videoTrackID | 90 videoTrackID:(NSString*)videoTrackID |
| 91 audioTrackID:(NSString*)audioTrackID { | 91 audioTrackID:(NSString*)audioTrackID { |
| 92 RTCMediaStream* localMediaStream = [factory mediaStreamWithLabel:streamLabel]; | 92 RTCMediaStream* localMediaStream = [factory mediaStreamWithLabel:streamLabel]; |
| 93 RTCVideoTrack* videoTrack = | 93 // TODO(zeke): Fix this test to create a fake video capturer so that a track |
| 94 [factory videoTrackWithID:videoTrackID source:videoSource]; | 94 // can be created. |
| 95 RTCFakeRenderer* videoRenderer = [[RTCFakeRenderer alloc] init]; | 95 if (videoSource) { |
| 96 [videoTrack addRenderer:videoRenderer]; | 96 RTCVideoTrack* videoTrack = |
| 97 [localMediaStream addVideoTrack:videoTrack]; | 97 [factory videoTrackWithID:videoTrackID source:videoSource]; |
| 98 // Test that removal/re-add works. | 98 RTCFakeRenderer* videoRenderer = [[RTCFakeRenderer alloc] init]; |
| 99 [localMediaStream removeVideoTrack:videoTrack]; | 99 [videoTrack addRenderer:videoRenderer]; |
| 100 [localMediaStream addVideoTrack:videoTrack]; | 100 [localMediaStream addVideoTrack:videoTrack]; |
| 101 // Test that removal/re-add works. |
| 102 [localMediaStream removeVideoTrack:videoTrack]; |
| 103 [localMediaStream addVideoTrack:videoTrack]; |
| 104 } |
| 101 RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID]; | 105 RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID]; |
| 102 [localMediaStream addAudioTrack:audioTrack]; | 106 [localMediaStream addAudioTrack:audioTrack]; |
| 103 [pc addStream:localMediaStream]; | 107 [pc addStream:localMediaStream]; |
| 104 return localMediaStream; | 108 return localMediaStream; |
| 105 } | 109 } |
| 106 | 110 |
| 107 - (void)testCompleteSessionWithFactory:(RTCPeerConnectionFactory*)factory { | 111 - (void)testCompleteSessionWithFactory:(RTCPeerConnectionFactory*)factory { |
| 108 NSArray* mandatory = @[ | 112 NSArray* mandatory = @[ |
| 109 [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"], | 113 [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"], |
| 110 [[RTCPair alloc] initWithKey:@"internalSctpDataChannels" value:@"true"], | 114 [[RTCPair alloc] initWithKey:@"internalSctpDataChannels" value:@"true"], |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // factory outlives RTCPeerConnection:dealloc. | 341 // factory outlives RTCPeerConnection:dealloc. |
| 338 // See https://code.google.com/p/webrtc/issues/detail?id=3100. | 342 // See https://code.google.com/p/webrtc/issues/detail?id=3100. |
| 339 RTCPeerConnectionFactory* factory = [[RTCPeerConnectionFactory alloc] init]; | 343 RTCPeerConnectionFactory* factory = [[RTCPeerConnectionFactory alloc] init]; |
| 340 @autoreleasepool { | 344 @autoreleasepool { |
| 341 RTCPeerConnectionTest* pcTest = [[RTCPeerConnectionTest alloc] init]; | 345 RTCPeerConnectionTest* pcTest = [[RTCPeerConnectionTest alloc] init]; |
| 342 [pcTest testCompleteSessionWithFactory:factory]; | 346 [pcTest testCompleteSessionWithFactory:factory]; |
| 343 } | 347 } |
| 344 rtc::CleanupSSL(); | 348 rtc::CleanupSSL(); |
| 345 } | 349 } |
| 346 } | 350 } |
| OLD | NEW |