Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 && (dummyCodec.plfreq == 32000)) { | 134 && (dummyCodec.plfreq == 32000)) { |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 | 137 |
| 138 printf("Register Receive Codec %s ", dummyCodec.plname); | 138 printf("Register Receive Codec %s ", dummyCodec.plname); |
| 139 | 139 |
| 140 if ((n != 0) && !FixedPayloadTypeCodec(dummyCodec.plname)) { | 140 if ((n != 0) && !FixedPayloadTypeCodec(dummyCodec.plname)) { |
| 141 // Check registration with an already occupied payload type | 141 // Check registration with an already occupied payload type |
| 142 int currentPayloadType = dummyCodec.pltype; | 142 int currentPayloadType = dummyCodec.pltype; |
| 143 dummyCodec.pltype = 97; //lastPayloadType; | 143 dummyCodec.pltype = 97; //lastPayloadType; |
| 144 CHECK_ERROR(_acmB->RegisterReceiveCodec(dummyCodec)); | 144 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(dummyCodec.pltype, |
|
ossu
2016/10/05 13:39:58
Come to think of it, would it make sense to have t
kwiberg-webrtc
2016/10/06 12:14:52
That would make sense if we were planning to keep
| |
| 145 CodecInstToSdp(dummyCodec))); | |
| 145 dummyCodec.pltype = currentPayloadType; | 146 dummyCodec.pltype = currentPayloadType; |
| 146 } | 147 } |
| 147 | 148 |
| 148 if ((n < numCodecs - 1) && !FixedPayloadTypeCodec(dummyCodec.plname)) { | 149 if ((n < numCodecs - 1) && !FixedPayloadTypeCodec(dummyCodec.plname)) { |
| 149 // test if re-registration works; | 150 // test if re-registration works; |
| 150 CodecInst nextCodec; | 151 CodecInst nextCodec; |
| 151 int currentPayloadType = dummyCodec.pltype; | 152 int currentPayloadType = dummyCodec.pltype; |
| 152 AudioCodingModule::Codec(n + 1, &nextCodec); | 153 AudioCodingModule::Codec(n + 1, &nextCodec); |
| 153 dummyCodec.pltype = nextCodec.pltype; | 154 dummyCodec.pltype = nextCodec.pltype; |
| 154 if (!FixedPayloadTypeCodec(nextCodec.plname)) { | 155 if (!FixedPayloadTypeCodec(nextCodec.plname)) { |
| 155 _acmB->RegisterReceiveCodec(dummyCodec); | 156 _acmB->RegisterReceiveCodec(dummyCodec.pltype, |
| 157 CodecInstToSdp(dummyCodec)); | |
| 156 } | 158 } |
| 157 dummyCodec.pltype = currentPayloadType; | 159 dummyCodec.pltype = currentPayloadType; |
| 158 } | 160 } |
| 159 | 161 |
| 160 if ((n < numCodecs - 1) && !FixedPayloadTypeCodec(dummyCodec.plname)) { | 162 if ((n < numCodecs - 1) && !FixedPayloadTypeCodec(dummyCodec.plname)) { |
| 161 // test if un-registration works; | 163 // test if un-registration works; |
| 162 CodecInst nextCodec; | 164 CodecInst nextCodec; |
| 163 AudioCodingModule::Codec(n + 1, &nextCodec); | 165 AudioCodingModule::Codec(n + 1, &nextCodec); |
| 164 nextCodec.pltype = dummyCodec.pltype; | 166 nextCodec.pltype = dummyCodec.pltype; |
| 165 if (!FixedPayloadTypeCodec(nextCodec.plname)) { | 167 if (!FixedPayloadTypeCodec(nextCodec.plname)) { |
| 166 CHECK_ERROR_MT(_acmA->RegisterReceiveCodec(nextCodec)); | 168 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(nextCodec.pltype, |
| 169 CodecInstToSdp(nextCodec))); | |
| 167 CHECK_ERROR_MT(_acmA->UnregisterReceiveCodec(nextCodec.pltype)); | 170 CHECK_ERROR_MT(_acmA->UnregisterReceiveCodec(nextCodec.pltype)); |
| 168 } | 171 } |
| 169 } | 172 } |
| 170 | 173 |
| 171 CHECK_ERROR_MT(_acmA->RegisterReceiveCodec(dummyCodec)); | 174 EXPECT_EQ(true, _acmA->RegisterReceiveCodec(dummyCodec.pltype, |
| 175 CodecInstToSdp(dummyCodec))); | |
| 172 printf(" side A done!"); | 176 printf(" side A done!"); |
| 173 CHECK_ERROR_MT(_acmB->RegisterReceiveCodec(dummyCodec)); | 177 EXPECT_EQ(true, _acmB->RegisterReceiveCodec(dummyCodec.pltype, |
| 178 CodecInstToSdp(dummyCodec))); | |
| 174 printf(" side B done!\n"); | 179 printf(" side B done!\n"); |
| 175 | 180 |
| 176 if (!strcmp(dummyCodec.plname, "CN")) { | 181 if (!strcmp(dummyCodec.plname, "CN")) { |
| 177 CHECK_ERROR_MT(_acmA->RegisterSendCodec(dummyCodec)); | 182 CHECK_ERROR_MT(_acmA->RegisterSendCodec(dummyCodec)); |
| 178 CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec)); | 183 CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec)); |
| 179 } | 184 } |
| 180 lastPayloadType = dummyCodec.pltype; | 185 lastPayloadType = dummyCodec.pltype; |
| 181 if ((lastPayloadType >= 96) && (lastPayloadType <= 127)) { | 186 if ((lastPayloadType >= 96) && (lastPayloadType <= 127)) { |
| 182 _payloadUsed[lastPayloadType - 96] = true; | 187 _payloadUsed[lastPayloadType - 96] = true; |
| 183 } | 188 } |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 864 //myEvent->Wait(20); | 869 //myEvent->Wait(20); |
| 865 //CHECK_ERROR_MT(receiveACM->UnregisterReceiveCodec(myCodec->pltype)); | 870 //CHECK_ERROR_MT(receiveACM->UnregisterReceiveCodec(myCodec->pltype)); |
| 866 Wait(1000); | 871 Wait(1000); |
| 867 | 872 |
| 868 myCodec->pltype = currentPayload; | 873 myCodec->pltype = currentPayload; |
| 869 if (!_randomTest) { | 874 if (!_randomTest) { |
| 870 fprintf(stdout, | 875 fprintf(stdout, |
| 871 "Register receive codec with default Payload, AUDIO BACK.\n"); | 876 "Register receive codec with default Payload, AUDIO BACK.\n"); |
| 872 fflush (stdout); | 877 fflush (stdout); |
| 873 } | 878 } |
| 874 CHECK_ERROR_MT(receiveACM->RegisterReceiveCodec(*myCodec)); | 879 EXPECT_EQ(true, receiveACM->RegisterReceiveCodec( |
| 880 myCodec->pltype, CodecInstToSdp(*myCodec))); | |
| 875 //CHECK_ERROR_MT(sendACM->RegisterSendCodec(*myCodec)); | 881 //CHECK_ERROR_MT(sendACM->RegisterSendCodec(*myCodec)); |
| 876 myEvent->Wait(20); | 882 myEvent->Wait(20); |
| 877 { | 883 { |
| 878 WriteLockScoped wl(_apiTestRWLock); | 884 WriteLockScoped wl(_apiTestRWLock); |
| 879 *thereIsDecoder = true; | 885 *thereIsDecoder = true; |
| 880 } | 886 } |
| 881 Wait(1000); | 887 Wait(1000); |
| 882 | 888 |
| 883 break; | 889 break; |
| 884 } | 890 } |
| 885 } | 891 } |
| 886 if (i == 32) { | 892 if (i == 32) { |
| 887 CHECK_ERROR_MT(receiveACM->RegisterReceiveCodec(*myCodec)); | 893 EXPECT_EQ(true, receiveACM->RegisterReceiveCodec( |
| 894 myCodec->pltype, CodecInstToSdp(*myCodec))); | |
| 888 { | 895 { |
| 889 WriteLockScoped wl(_apiTestRWLock); | 896 WriteLockScoped wl(_apiTestRWLock); |
| 890 *thereIsDecoder = true; | 897 *thereIsDecoder = true; |
| 891 } | 898 } |
| 892 } | 899 } |
| 893 } else { | 900 } else { |
| 894 if (!_randomTest) { | 901 if (!_randomTest) { |
| 895 fprintf(stdout, | 902 fprintf(stdout, |
| 896 "Register receive codec with fixed Payload, AUDIO BACK.\n"); | 903 "Register receive codec with fixed Payload, AUDIO BACK.\n"); |
| 897 fflush (stdout); | 904 fflush (stdout); |
| 898 } | 905 } |
| 899 CHECK_ERROR_MT(receiveACM->RegisterReceiveCodec(*myCodec)); | 906 EXPECT_EQ(true, receiveACM->RegisterReceiveCodec(myCodec->pltype, |
| 907 CodecInstToSdp(*myCodec))); | |
| 900 //CHECK_ERROR_MT(receiveACM->UnregisterReceiveCodec(myCodec->pltype)); | 908 //CHECK_ERROR_MT(receiveACM->UnregisterReceiveCodec(myCodec->pltype)); |
| 901 //CHECK_ERROR_MT(receiveACM->RegisterReceiveCodec(*myCodec)); | 909 //CHECK_ERROR_MT(receiveACM->RegisterReceiveCodec(*myCodec)); |
| 902 myEvent->Wait(20); | 910 myEvent->Wait(20); |
| 903 { | 911 { |
| 904 WriteLockScoped wl(_apiTestRWLock); | 912 WriteLockScoped wl(_apiTestRWLock); |
| 905 *thereIsDecoder = true; | 913 *thereIsDecoder = true; |
| 906 } | 914 } |
| 907 } | 915 } |
| 908 delete myEvent; | 916 delete myEvent; |
| 909 if (!_randomTest) { | 917 if (!_randomTest) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); | 1105 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); |
| 1098 myChannel->ResetStats(); | 1106 myChannel->ResetStats(); |
| 1099 { | 1107 { |
| 1100 WriteLockScoped wl(_apiTestRWLock); | 1108 WriteLockScoped wl(_apiTestRWLock); |
| 1101 *thereIsEncoder = true; | 1109 *thereIsEncoder = true; |
| 1102 } | 1110 } |
| 1103 Wait(500); | 1111 Wait(500); |
| 1104 } | 1112 } |
| 1105 | 1113 |
| 1106 } // namespace webrtc | 1114 } // namespace webrtc |
| OLD | NEW |