Commit e6053d8
committed
Fix crash where a remote stream is removed before the promise resolves.
setRemoteDescription() ("SRD") is executed on the main thread, does work
on the webrtc signaling thread which has callbacks that jump back to the
main thread to fire events and resolve the promise.
The callback on the main thread needs to know about the stream, tracks
and their receivers. Previously, we invoked native_peer_connection_
->GetReceivers() in the main thread callback. This was problematic in
this case:
SRD that adds stream x
SRD that removes stream x
By the time we do GetReceivers() in the main thread callback the stream
may already have been removed from the native_peer_connection_ by the
second SRD call. This lead to a crash because it couldn't find the
receivers of the added stream.
The fix is to do the GetReceivers() call while still on the webrtc
signaling thread and not do any querying of the
native_peer_connection_'s state from the main thread callback.
Calling SRD in succession without waiting for the promises to resolve
is inherently racey but this ensures the events fire without crashing
and that we end up in the correct state. The indeterminate (racey) part
is whether or not the stream fired in the first ontrack/onaddstream
events contain the first track or is empty.
TBR=hbos@chromium.org
(cherry picked from commit 545dbdf)
Bug: 759324
Change-Id: Icdbf6f255a046ddf67feee2e59dab48952219184
Reviewed-on: https://chromium-review.googlesource.com/647531
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#499601}
Reviewed-on: https://chromium-review.googlesource.com/657101
Reviewed-by: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/branch-heads/3202@{#85}
Cr-Branched-From: fa6a5d8-refs/heads/master@{#499098}1 parent 6d09a73 commit e6053d8
File tree
9 files changed
+189
-76
lines changed- chrome
- browser/media/webrtc
- test/data/webrtc
- content/renderer/media
- webrtc
9 files changed
+189
-76
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
278 | 342 | | |
279 | 343 | | |
280 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
945 | 951 | | |
946 | 952 | | |
947 | 953 | | |
| |||
995 | 1001 | | |
996 | 1002 | | |
997 | 1003 | | |
998 | | - | |
| 1004 | + | |
| 1005 | + | |
999 | 1006 | | |
1000 | 1007 | | |
1001 | 1008 | | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
1002 | 1013 | | |
1003 | 1014 | | |
1004 | 1015 | | |
| |||
1015 | 1026 | | |
1016 | 1027 | | |
1017 | 1028 | | |
1018 | | - | |
1019 | | - | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1020 | 1034 | | |
1021 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1022 | 1055 | | |
1023 | | - | |
1024 | | - | |
| 1056 | + | |
| 1057 | + | |
1025 | 1058 | | |
1026 | 1059 | | |
1027 | 1060 | | |
1028 | 1061 | | |
1029 | | - | |
| 1062 | + | |
| 1063 | + | |
1030 | 1064 | | |
1031 | 1065 | | |
1032 | 1066 | | |
| |||
1101 | 1135 | | |
1102 | 1136 | | |
1103 | 1137 | | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1107 | 1145 | | |
1108 | 1146 | | |
1109 | 1147 | | |
| |||
1128 | 1166 | | |
1129 | 1167 | | |
1130 | 1168 | | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1131 | 1172 | | |
1132 | 1173 | | |
1133 | 1174 | | |
| |||
1197 | 1238 | | |
1198 | 1239 | | |
1199 | 1240 | | |
| 1241 | + | |
1200 | 1242 | | |
1201 | 1243 | | |
1202 | 1244 | | |
| |||
1225 | 1267 | | |
1226 | 1268 | | |
1227 | 1269 | | |
| 1270 | + | |
1228 | 1271 | | |
1229 | 1272 | | |
1230 | 1273 | | |
| |||
1991 | 2034 | | |
1992 | 2035 | | |
1993 | 2036 | | |
1994 | | - | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
1995 | 2040 | | |
1996 | 2041 | | |
1997 | 2042 | | |
| |||
2011 | 2056 | | |
2012 | 2057 | | |
2013 | 2058 | | |
2014 | | - | |
2015 | | - | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
2019 | | - | |
2020 | | - | |
2021 | | - | |
2022 | | - | |
2023 | | - | |
2024 | | - | |
2025 | | - | |
2026 | | - | |
2027 | | - | |
2028 | | - | |
2029 | | - | |
2030 | | - | |
2031 | | - | |
2032 | | - | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
2033 | 2064 | | |
2034 | | - | |
| 2065 | + | |
| 2066 | + | |
2035 | 2067 | | |
2036 | 2068 | | |
2037 | 2069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
| 92 | + | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
0 commit comments