Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef _WEBRTC_GLOBAL_H_
6 : #define _WEBRTC_GLOBAL_H_
7 :
8 : #include "ipc/IPCMessageUtils.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/RTCStatsReportBinding.h"
11 : #include "nsAutoPtr.h"
12 :
13 : typedef mozilla::dom::RTCStatsReportInternal StatsReport;
14 : typedef nsTArray< nsAutoPtr<StatsReport>> RTCReports;
15 : typedef mozilla::dom::Sequence<nsString> WebrtcGlobalLog;
16 :
17 : namespace IPC {
18 :
19 : template<typename T>
20 : struct ParamTraits<mozilla::dom::Optional<T>>
21 : {
22 : typedef mozilla::dom::Optional<T> paramType;
23 :
24 0 : static void Write(Message* aMsg, const paramType& aParam)
25 : {
26 0 : if (aParam.WasPassed()) {
27 0 : WriteParam(aMsg, true);
28 0 : WriteParam(aMsg, aParam.Value());
29 0 : return;
30 : }
31 :
32 0 : WriteParam(aMsg, false);
33 : }
34 :
35 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
36 : {
37 0 : bool was_passed = false;
38 :
39 0 : if (!ReadParam(aMsg, aIter, &was_passed)) {
40 0 : return false;
41 : }
42 :
43 0 : aResult->Reset(); //XXX Optional_base seems to reach this point with isSome true.
44 :
45 0 : if (was_passed) {
46 0 : if (!ReadParam(aMsg, aIter, &(aResult->Construct()))) {
47 0 : return false;
48 : }
49 : }
50 :
51 0 : return true;
52 : }
53 : };
54 :
55 : template<typename T>
56 : struct ParamTraits<mozilla::dom::Sequence<T>>
57 : {
58 : typedef mozilla::dom::Sequence<T> paramType;
59 :
60 0 : static void Write(Message* aMsg, const paramType& aParam)
61 : {
62 0 : WriteParam(aMsg, static_cast<const FallibleTArray<T>&>(aParam));
63 0 : }
64 :
65 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
66 : {
67 0 : return ReadParam(aMsg, aIter, dynamic_cast<FallibleTArray<T>*>(aResult));
68 : }
69 : };
70 :
71 : template<>
72 : struct ParamTraits<mozilla::dom::RTCStatsType> :
73 : public ContiguousEnumSerializer<
74 : mozilla::dom::RTCStatsType,
75 : mozilla::dom::RTCStatsType::Inbound_rtp,
76 : mozilla::dom::RTCStatsType::EndGuard_>
77 : {};
78 :
79 : template<>
80 : struct ParamTraits<mozilla::dom::RTCStatsIceCandidatePairState> :
81 : public ContiguousEnumSerializer<
82 : mozilla::dom::RTCStatsIceCandidatePairState,
83 : mozilla::dom::RTCStatsIceCandidatePairState::Frozen,
84 : mozilla::dom::RTCStatsIceCandidatePairState::EndGuard_>
85 : {};
86 :
87 : template<>
88 : struct ParamTraits<mozilla::dom::RTCStatsIceCandidateType> :
89 : public ContiguousEnumSerializer<
90 : mozilla::dom::RTCStatsIceCandidateType,
91 : mozilla::dom::RTCStatsIceCandidateType::Host,
92 : mozilla::dom::RTCStatsIceCandidateType::EndGuard_>
93 : {};
94 :
95 : template<>
96 : struct ParamTraits<mozilla::dom::RTCStatsReportInternal>
97 : {
98 : typedef mozilla::dom::RTCStatsReportInternal paramType;
99 :
100 0 : static void Write(Message* aMsg, const paramType& aParam)
101 : {
102 0 : WriteParam(aMsg, aParam.mClosed);
103 0 : WriteParam(aMsg, aParam.mCodecStats);
104 0 : WriteParam(aMsg, aParam.mIceCandidatePairStats);
105 0 : WriteParam(aMsg, aParam.mIceCandidateStats);
106 0 : WriteParam(aMsg, aParam.mIceComponentStats);
107 0 : WriteParam(aMsg, aParam.mInboundRTPStreamStats);
108 0 : WriteParam(aMsg, aParam.mLocalSdp);
109 0 : WriteParam(aMsg, aParam.mMediaStreamStats);
110 0 : WriteParam(aMsg, aParam.mMediaStreamTrackStats);
111 0 : WriteParam(aMsg, aParam.mOutboundRTPStreamStats);
112 0 : WriteParam(aMsg, aParam.mPcid);
113 0 : WriteParam(aMsg, aParam.mRemoteSdp);
114 0 : WriteParam(aMsg, aParam.mTimestamp);
115 0 : WriteParam(aMsg, aParam.mIceRestarts);
116 0 : WriteParam(aMsg, aParam.mIceRollbacks);
117 0 : WriteParam(aMsg, aParam.mTransportStats);
118 0 : WriteParam(aMsg, aParam.mRtpContributingSourceStats);
119 0 : }
120 :
121 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
122 : {
123 0 : if (!ReadParam(aMsg, aIter, &(aResult->mClosed)) ||
124 0 : !ReadParam(aMsg, aIter, &(aResult->mCodecStats)) ||
125 0 : !ReadParam(aMsg, aIter, &(aResult->mIceCandidatePairStats)) ||
126 0 : !ReadParam(aMsg, aIter, &(aResult->mIceCandidateStats)) ||
127 0 : !ReadParam(aMsg, aIter, &(aResult->mIceComponentStats)) ||
128 0 : !ReadParam(aMsg, aIter, &(aResult->mInboundRTPStreamStats)) ||
129 0 : !ReadParam(aMsg, aIter, &(aResult->mLocalSdp)) ||
130 0 : !ReadParam(aMsg, aIter, &(aResult->mMediaStreamStats)) ||
131 0 : !ReadParam(aMsg, aIter, &(aResult->mMediaStreamTrackStats)) ||
132 0 : !ReadParam(aMsg, aIter, &(aResult->mOutboundRTPStreamStats)) ||
133 0 : !ReadParam(aMsg, aIter, &(aResult->mPcid)) ||
134 0 : !ReadParam(aMsg, aIter, &(aResult->mRemoteSdp)) ||
135 0 : !ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
136 0 : !ReadParam(aMsg, aIter, &(aResult->mIceRestarts)) ||
137 0 : !ReadParam(aMsg, aIter, &(aResult->mIceRollbacks)) ||
138 0 : !ReadParam(aMsg, aIter, &(aResult->mTransportStats)) ||
139 0 : !ReadParam(aMsg, aIter, &(aResult->mRtpContributingSourceStats))) {
140 0 : return false;
141 : }
142 :
143 0 : return true;
144 : }
145 : };
146 :
147 : typedef mozilla::dom::RTCStats RTCStats;
148 :
149 0 : static void WriteRTCStats(Message* aMsg, const RTCStats& aParam)
150 : {
151 : // RTCStats base class
152 0 : WriteParam(aMsg, aParam.mId);
153 0 : WriteParam(aMsg, aParam.mTimestamp);
154 0 : WriteParam(aMsg, aParam.mType);
155 0 : }
156 :
157 0 : static bool ReadRTCStats(const Message* aMsg, PickleIterator* aIter, RTCStats* aResult)
158 : {
159 : // RTCStats base class
160 0 : if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
161 0 : !ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
162 0 : !ReadParam(aMsg, aIter, &(aResult->mType))) {
163 0 : return false;
164 : }
165 :
166 0 : return true;
167 : }
168 :
169 : template<>
170 : struct ParamTraits<mozilla::dom::RTCCodecStats>
171 : {
172 : typedef mozilla::dom::RTCCodecStats paramType;
173 :
174 0 : static void Write(Message* aMsg, const paramType& aParam)
175 : {
176 0 : WriteParam(aMsg, aParam.mChannels);
177 0 : WriteParam(aMsg, aParam.mClockRate);
178 0 : WriteParam(aMsg, aParam.mCodec);
179 0 : WriteParam(aMsg, aParam.mParameters);
180 0 : WriteParam(aMsg, aParam.mPayloadType);
181 0 : WriteRTCStats(aMsg, aParam);
182 0 : }
183 :
184 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
185 : {
186 0 : if (!ReadParam(aMsg, aIter, &(aResult->mChannels)) ||
187 0 : !ReadParam(aMsg, aIter, &(aResult->mClockRate)) ||
188 0 : !ReadParam(aMsg, aIter, &(aResult->mCodec)) ||
189 0 : !ReadParam(aMsg, aIter, &(aResult->mParameters)) ||
190 0 : !ReadParam(aMsg, aIter, &(aResult->mPayloadType)) ||
191 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
192 0 : return false;
193 : }
194 :
195 0 : return true;
196 : }
197 : };
198 :
199 : template<>
200 : struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
201 : {
202 : typedef mozilla::dom::RTCIceCandidatePairStats paramType;
203 :
204 0 : static void Write(Message* aMsg, const paramType& aParam)
205 : {
206 0 : WriteParam(aMsg, aParam.mTransportId);
207 0 : WriteParam(aMsg, aParam.mLocalCandidateId);
208 0 : WriteParam(aMsg, aParam.mPriority);
209 0 : WriteParam(aMsg, aParam.mNominated);
210 0 : WriteParam(aMsg, aParam.mWritable);
211 0 : WriteParam(aMsg, aParam.mReadable);
212 0 : WriteParam(aMsg, aParam.mRemoteCandidateId);
213 0 : WriteParam(aMsg, aParam.mSelected);
214 0 : WriteParam(aMsg, aParam.mState);
215 0 : WriteParam(aMsg, aParam.mBytesSent);
216 0 : WriteParam(aMsg, aParam.mBytesReceived);
217 0 : WriteParam(aMsg, aParam.mLastPacketSentTimestamp);
218 0 : WriteParam(aMsg, aParam.mLastPacketReceivedTimestamp);
219 0 : WriteRTCStats(aMsg, aParam);
220 0 : }
221 :
222 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
223 : {
224 0 : if (!ReadParam(aMsg, aIter, &(aResult->mTransportId)) ||
225 0 : !ReadParam(aMsg, aIter, &(aResult->mLocalCandidateId)) ||
226 0 : !ReadParam(aMsg, aIter, &(aResult->mPriority)) ||
227 0 : !ReadParam(aMsg, aIter, &(aResult->mNominated)) ||
228 0 : !ReadParam(aMsg, aIter, &(aResult->mWritable)) ||
229 0 : !ReadParam(aMsg, aIter, &(aResult->mReadable)) ||
230 0 : !ReadParam(aMsg, aIter, &(aResult->mRemoteCandidateId)) ||
231 0 : !ReadParam(aMsg, aIter, &(aResult->mSelected)) ||
232 0 : !ReadParam(aMsg, aIter, &(aResult->mState)) ||
233 0 : !ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
234 0 : !ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
235 0 : !ReadParam(aMsg, aIter, &(aResult->mLastPacketSentTimestamp)) ||
236 0 : !ReadParam(aMsg, aIter, &(aResult->mLastPacketReceivedTimestamp)) ||
237 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
238 0 : return false;
239 : }
240 :
241 0 : return true;
242 : }
243 : };
244 :
245 : template<>
246 : struct ParamTraits<mozilla::dom::RTCIceCandidateStats>
247 : {
248 : typedef mozilla::dom::RTCIceCandidateStats paramType;
249 :
250 0 : static void Write(Message* aMsg, const paramType& aParam)
251 : {
252 0 : WriteParam(aMsg, aParam.mCandidateId);
253 0 : WriteParam(aMsg, aParam.mCandidateType);
254 0 : WriteParam(aMsg, aParam.mComponentId);
255 0 : WriteParam(aMsg, aParam.mIpAddress);
256 0 : WriteParam(aMsg, aParam.mMozLocalTransport);
257 0 : WriteParam(aMsg, aParam.mPortNumber);
258 0 : WriteParam(aMsg, aParam.mTransport);
259 0 : WriteRTCStats(aMsg, aParam);
260 0 : }
261 :
262 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
263 : {
264 0 : if (!ReadParam(aMsg, aIter, &(aResult->mCandidateId)) ||
265 0 : !ReadParam(aMsg, aIter, &(aResult->mCandidateType)) ||
266 0 : !ReadParam(aMsg, aIter, &(aResult->mComponentId)) ||
267 0 : !ReadParam(aMsg, aIter, &(aResult->mIpAddress)) ||
268 0 : !ReadParam(aMsg, aIter, &(aResult->mMozLocalTransport)) ||
269 0 : !ReadParam(aMsg, aIter, &(aResult->mPortNumber)) ||
270 0 : !ReadParam(aMsg, aIter, &(aResult->mTransport)) ||
271 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
272 0 : return false;
273 : }
274 :
275 0 : return true;
276 : }
277 : };
278 :
279 : template<>
280 : struct ParamTraits<mozilla::dom::RTCIceComponentStats>
281 : {
282 : typedef mozilla::dom::RTCIceComponentStats paramType;
283 :
284 0 : static void Write(Message* aMsg, const paramType& aParam)
285 : {
286 0 : WriteParam(aMsg, aParam.mActiveConnection);
287 0 : WriteParam(aMsg, aParam.mBytesReceived);
288 0 : WriteParam(aMsg, aParam.mBytesSent);
289 0 : WriteParam(aMsg, aParam.mComponent);
290 0 : WriteParam(aMsg, aParam.mTransportId);
291 0 : WriteRTCStats(aMsg, aParam);
292 0 : }
293 :
294 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
295 : {
296 0 : if (!ReadParam(aMsg, aIter, &(aResult->mActiveConnection)) ||
297 0 : !ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
298 0 : !ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
299 0 : !ReadParam(aMsg, aIter, &(aResult->mComponent)) ||
300 0 : !ReadParam(aMsg, aIter, &(aResult->mTransportId)) ||
301 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
302 0 : return false;
303 : }
304 :
305 0 : return true;
306 : }
307 : };
308 :
309 0 : static void WriteRTCRTPStreamStats(
310 : Message* aMsg,
311 : const mozilla::dom::RTCRTPStreamStats& aParam)
312 : {
313 0 : WriteParam(aMsg, aParam.mBitrateMean);
314 0 : WriteParam(aMsg, aParam.mBitrateStdDev);
315 0 : WriteParam(aMsg, aParam.mCodecId);
316 0 : WriteParam(aMsg, aParam.mFramerateMean);
317 0 : WriteParam(aMsg, aParam.mFramerateStdDev);
318 0 : WriteParam(aMsg, aParam.mIsRemote);
319 0 : WriteParam(aMsg, aParam.mMediaTrackId);
320 0 : WriteParam(aMsg, aParam.mMediaType);
321 0 : WriteParam(aMsg, aParam.mRemoteId);
322 0 : WriteParam(aMsg, aParam.mSsrc);
323 0 : WriteParam(aMsg, aParam.mTransportId);
324 0 : }
325 :
326 0 : static bool ReadRTCRTPStreamStats(
327 : const Message* aMsg, PickleIterator* aIter,
328 : mozilla::dom::RTCRTPStreamStats* aResult)
329 : {
330 0 : if (!ReadParam(aMsg, aIter, &(aResult->mBitrateMean)) ||
331 0 : !ReadParam(aMsg, aIter, &(aResult->mBitrateStdDev)) ||
332 0 : !ReadParam(aMsg, aIter, &(aResult->mCodecId)) ||
333 0 : !ReadParam(aMsg, aIter, &(aResult->mFramerateMean)) ||
334 0 : !ReadParam(aMsg, aIter, &(aResult->mFramerateStdDev)) ||
335 0 : !ReadParam(aMsg, aIter, &(aResult->mIsRemote)) ||
336 0 : !ReadParam(aMsg, aIter, &(aResult->mMediaTrackId)) ||
337 0 : !ReadParam(aMsg, aIter, &(aResult->mMediaType)) ||
338 0 : !ReadParam(aMsg, aIter, &(aResult->mRemoteId)) ||
339 0 : !ReadParam(aMsg, aIter, &(aResult->mSsrc)) ||
340 0 : !ReadParam(aMsg, aIter, &(aResult->mTransportId))) {
341 0 : return false;
342 : }
343 :
344 0 : return true;
345 : }
346 :
347 : template<>
348 : struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats>
349 : {
350 : typedef mozilla::dom::RTCInboundRTPStreamStats paramType;
351 :
352 0 : static void Write(Message* aMsg, const paramType& aParam)
353 : {
354 0 : WriteParam(aMsg, aParam.mBytesReceived);
355 0 : WriteParam(aMsg, aParam.mDiscardedPackets);
356 0 : WriteParam(aMsg, aParam.mFramesDecoded);
357 0 : WriteParam(aMsg, aParam.mJitter);
358 0 : WriteParam(aMsg, aParam.mMozAvSyncDelay);
359 0 : WriteParam(aMsg, aParam.mMozJitterBufferDelay);
360 0 : WriteParam(aMsg, aParam.mRoundTripTime);
361 0 : WriteParam(aMsg, aParam.mPacketsLost);
362 0 : WriteParam(aMsg, aParam.mPacketsReceived);
363 0 : WriteRTCRTPStreamStats(aMsg, aParam);
364 0 : WriteRTCStats(aMsg, aParam);
365 0 : }
366 :
367 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
368 : {
369 0 : if (!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
370 0 : !ReadParam(aMsg, aIter, &(aResult->mDiscardedPackets)) ||
371 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesDecoded)) ||
372 0 : !ReadParam(aMsg, aIter, &(aResult->mJitter)) ||
373 0 : !ReadParam(aMsg, aIter, &(aResult->mMozAvSyncDelay)) ||
374 0 : !ReadParam(aMsg, aIter, &(aResult->mMozJitterBufferDelay)) ||
375 0 : !ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
376 0 : !ReadParam(aMsg, aIter, &(aResult->mPacketsLost)) ||
377 0 : !ReadParam(aMsg, aIter, &(aResult->mPacketsReceived)) ||
378 0 : !ReadRTCRTPStreamStats(aMsg, aIter, aResult) ||
379 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
380 0 : return false;
381 : }
382 :
383 0 : return true;
384 : }
385 : };
386 :
387 : template<>
388 : struct ParamTraits<mozilla::dom::RTCOutboundRTPStreamStats>
389 : {
390 : typedef mozilla::dom::RTCOutboundRTPStreamStats paramType;
391 :
392 0 : static void Write(Message* aMsg, const paramType& aParam)
393 : {
394 0 : WriteParam(aMsg, aParam.mBytesSent);
395 0 : WriteParam(aMsg, aParam.mDroppedFrames);
396 0 : WriteParam(aMsg, aParam.mPacketsSent);
397 0 : WriteParam(aMsg, aParam.mTargetBitrate);
398 0 : WriteParam(aMsg, aParam.mFramesEncoded);
399 0 : WriteParam(aMsg, aParam.mFirCount);
400 0 : WriteParam(aMsg, aParam.mNackCount);
401 0 : WriteParam(aMsg, aParam.mPliCount);
402 0 : WriteRTCRTPStreamStats(aMsg, aParam);
403 0 : WriteRTCStats(aMsg, aParam);
404 0 : }
405 :
406 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
407 : {
408 0 : if (!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
409 0 : !ReadParam(aMsg, aIter, &(aResult->mDroppedFrames)) ||
410 0 : !ReadParam(aMsg, aIter, &(aResult->mPacketsSent)) ||
411 0 : !ReadParam(aMsg, aIter, &(aResult->mTargetBitrate)) ||
412 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) ||
413 0 : !ReadParam(aMsg, aIter, &(aResult->mFirCount)) ||
414 0 : !ReadParam(aMsg, aIter, &(aResult->mNackCount)) ||
415 0 : !ReadParam(aMsg, aIter, &(aResult->mPliCount)) ||
416 0 : !ReadRTCRTPStreamStats(aMsg, aIter, aResult) ||
417 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
418 0 : return false;
419 : }
420 :
421 0 : return true;
422 : }
423 : };
424 :
425 : template<>
426 : struct ParamTraits<mozilla::dom::RTCMediaStreamStats>
427 : {
428 : typedef mozilla::dom::RTCMediaStreamStats paramType;
429 :
430 0 : static void Write(Message* aMsg, const paramType& aParam)
431 : {
432 0 : WriteParam(aMsg, aParam.mStreamIdentifier);
433 0 : WriteParam(aMsg, aParam.mTrackIds);
434 0 : WriteRTCStats(aMsg, aParam);
435 0 : }
436 :
437 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
438 : {
439 0 : if (!ReadParam(aMsg, aIter, &(aResult->mStreamIdentifier)) ||
440 0 : !ReadParam(aMsg, aIter, &(aResult->mTrackIds)) ||
441 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
442 0 : return false;
443 : }
444 :
445 0 : return true;
446 : }
447 : };
448 :
449 : template<>
450 : struct ParamTraits<mozilla::dom::RTCTransportStats>
451 : {
452 : typedef mozilla::dom::RTCTransportStats paramType;
453 :
454 0 : static void Write(Message* aMsg, const paramType& aParam)
455 : {
456 0 : WriteParam(aMsg, aParam.mBytesReceived);
457 0 : WriteParam(aMsg, aParam.mBytesSent);
458 0 : WriteRTCStats(aMsg, aParam);
459 0 : }
460 :
461 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
462 : {
463 0 : if (!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
464 0 : !ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
465 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
466 0 : return false;
467 : }
468 :
469 0 : return true;
470 : }
471 : };
472 :
473 : template<>
474 : struct ParamTraits<mozilla::dom::RTCMediaStreamTrackStats>
475 : {
476 : typedef mozilla::dom::RTCMediaStreamTrackStats paramType;
477 :
478 0 : static void Write(Message* aMsg, const paramType& aParam)
479 : {
480 0 : WriteParam(aMsg, aParam.mAudioLevel);
481 0 : WriteParam(aMsg, aParam.mEchoReturnLoss);
482 0 : WriteParam(aMsg, aParam.mEchoReturnLossEnhancement);
483 0 : WriteParam(aMsg, aParam.mFrameHeight);
484 0 : WriteParam(aMsg, aParam.mFrameWidth);
485 0 : WriteParam(aMsg, aParam.mFramesCorrupted);
486 0 : WriteParam(aMsg, aParam.mFramesDecoded);
487 0 : WriteParam(aMsg, aParam.mFramesDropped);
488 0 : WriteParam(aMsg, aParam.mFramesPerSecond);
489 0 : WriteParam(aMsg, aParam.mFramesReceived);
490 0 : WriteParam(aMsg, aParam.mFramesSent);
491 0 : WriteParam(aMsg, aParam.mRemoteSource);
492 0 : WriteParam(aMsg, aParam.mSsrcIds);
493 0 : WriteParam(aMsg, aParam.mTrackIdentifier);
494 0 : WriteRTCStats(aMsg, aParam);
495 0 : }
496 :
497 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
498 : {
499 0 : if (!ReadParam(aMsg, aIter, &(aResult->mAudioLevel)) ||
500 0 : !ReadParam(aMsg, aIter, &(aResult->mEchoReturnLoss)) ||
501 0 : !ReadParam(aMsg, aIter, &(aResult->mEchoReturnLossEnhancement)) ||
502 0 : !ReadParam(aMsg, aIter, &(aResult->mFrameHeight)) ||
503 0 : !ReadParam(aMsg, aIter, &(aResult->mFrameWidth)) ||
504 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesCorrupted)) ||
505 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesDecoded)) ||
506 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesDropped)) ||
507 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesPerSecond)) ||
508 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesReceived)) ||
509 0 : !ReadParam(aMsg, aIter, &(aResult->mFramesSent)) ||
510 0 : !ReadParam(aMsg, aIter, &(aResult->mRemoteSource)) ||
511 0 : !ReadParam(aMsg, aIter, &(aResult->mSsrcIds)) ||
512 0 : !ReadParam(aMsg, aIter, &(aResult->mTrackIdentifier)) ||
513 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
514 0 : return false;
515 : }
516 :
517 0 : return true;
518 : }
519 : };
520 :
521 : template<>
522 : struct ParamTraits<mozilla::dom::RTCRTPContributingSourceStats>
523 : {
524 : typedef mozilla::dom::RTCRTPContributingSourceStats paramType;
525 :
526 0 : static void Write(Message* aMsg, const paramType& aParam)
527 : {
528 0 : WriteParam(aMsg, aParam.mContributorSsrc);
529 0 : WriteParam(aMsg, aParam.mInboundRtpStreamId);
530 0 : WriteRTCStats(aMsg, aParam);
531 0 : }
532 :
533 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
534 : {
535 0 : if (!ReadParam(aMsg, aIter, &(aResult->mContributorSsrc)) ||
536 0 : !ReadParam(aMsg, aIter, &(aResult->mInboundRtpStreamId)) ||
537 0 : !ReadRTCStats(aMsg, aIter, aResult)) {
538 0 : return false;
539 : }
540 0 : return true;
541 : }
542 : };
543 :
544 : } // namespace ipc
545 :
546 : #endif // _WEBRTC_GLOBAL_H_
|