Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: webrtc/voice_engine/channel.h

Issue 1263223002: Adding locking to webrtc::voe::Channel to fix race conditions (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Responding to comment Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/voice_engine/channel.cc » ('j') | webrtc/voice_engine/channel.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 int SetChannelOutputVolumeScaling(float scaling); 267 int SetChannelOutputVolumeScaling(float scaling);
268 int GetChannelOutputVolumeScaling(float& scaling) const; 268 int GetChannelOutputVolumeScaling(float& scaling) const;
269 269
270 // VoENetEqStats 270 // VoENetEqStats
271 int GetNetworkStatistics(NetworkStatistics& stats); 271 int GetNetworkStatistics(NetworkStatistics& stats);
272 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const; 272 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const;
273 273
274 // VoEVideoSync 274 // VoEVideoSync
275 bool GetDelayEstimate(int* jitter_buffer_delay_ms, 275 bool GetDelayEstimate(int* jitter_buffer_delay_ms,
276 int* playout_buffer_delay_ms) const; 276 int* playout_buffer_delay_ms) const;
277 int least_required_delay_ms() const { return least_required_delay_ms_; } 277 int LeastRequiredDelayMs() const {
278 return audio_coding_->LeastRequiredDelayMs();
Henrik Grunell WebRTC 2015/08/12 15:03:22 Move to implementation file.
Taylor Brandstetter 2015/08/12 19:49:04 Done.
279 }
278 int SetInitialPlayoutDelay(int delay_ms); 280 int SetInitialPlayoutDelay(int delay_ms);
279 int SetMinimumPlayoutDelay(int delayMs); 281 int SetMinimumPlayoutDelay(int delayMs);
280 int GetPlayoutTimestamp(unsigned int& timestamp); 282 int GetPlayoutTimestamp(unsigned int& timestamp);
281 void UpdatePlayoutTimestamp(bool rtcp);
282 int SetInitTimestamp(unsigned int timestamp); 283 int SetInitTimestamp(unsigned int timestamp);
283 int SetInitSequenceNumber(short sequenceNumber); 284 int SetInitSequenceNumber(short sequenceNumber);
284 285
285 // VoEVideoSyncExtended 286 // VoEVideoSyncExtended
286 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const; 287 int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const;
287 288
288 // VoEDtmf 289 // VoEDtmf
289 int SendTelephoneEventOutband(unsigned char eventCode, int lengthMs, 290 int SendTelephoneEventOutband(unsigned char eventCode, int lengthMs,
290 int attenuationDb, bool playDtmfEvent); 291 int attenuationDb, bool playDtmfEvent);
291 int SendTelephoneEventInband(unsigned char eventCode, int lengthMs, 292 int SendTelephoneEventInband(unsigned char eventCode, int lengthMs,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 bool HandleRtxPacket(const uint8_t* packet, 458 bool HandleRtxPacket(const uint8_t* packet,
458 size_t packet_length, 459 size_t packet_length,
459 const RTPHeader& header); 460 const RTPHeader& header);
460 bool IsPacketInOrder(const RTPHeader& header) const; 461 bool IsPacketInOrder(const RTPHeader& header) const;
461 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; 462 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const;
462 int ResendPackets(const uint16_t* sequence_numbers, int length); 463 int ResendPackets(const uint16_t* sequence_numbers, int length);
463 int InsertInbandDtmfTone(); 464 int InsertInbandDtmfTone();
464 int32_t MixOrReplaceAudioWithFile(int mixingFrequency); 465 int32_t MixOrReplaceAudioWithFile(int mixingFrequency);
465 int32_t MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency); 466 int32_t MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency);
466 int32_t SendPacketRaw(const void *data, size_t len, bool RTCP); 467 int32_t SendPacketRaw(const void *data, size_t len, bool RTCP);
468 void UpdatePlayoutTimestamp(bool rtcp);
467 void UpdatePacketDelay(uint32_t timestamp, 469 void UpdatePacketDelay(uint32_t timestamp,
468 uint16_t sequenceNumber); 470 uint16_t sequenceNumber);
469 void RegisterReceiveCodecsToRTPModule(); 471 void RegisterReceiveCodecsToRTPModule();
470 472
471 int SetRedPayloadType(int red_payload_type); 473 int SetRedPayloadType(int red_payload_type);
472 int SetSendRtpHeaderExtension(bool enable, RTPExtensionType type, 474 int SetSendRtpHeaderExtension(bool enable, RTPExtensionType type,
473 unsigned char id); 475 unsigned char id);
474 476
475 int32_t GetPlayoutFrequency(); 477 int32_t GetPlayoutFrequency();
476 int64_t GetRTT(bool allow_associate_channel) const; 478 int64_t GetRTT(bool allow_associate_channel) const;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 bool _outputExternalMedia; 511 bool _outputExternalMedia;
510 VoEMediaProcess* _inputExternalMediaCallbackPtr; 512 VoEMediaProcess* _inputExternalMediaCallbackPtr;
511 VoEMediaProcess* _outputExternalMediaCallbackPtr; 513 VoEMediaProcess* _outputExternalMediaCallbackPtr;
512 uint32_t _timeStamp; 514 uint32_t _timeStamp;
513 uint8_t _sendTelephoneEventPayloadType; 515 uint8_t _sendTelephoneEventPayloadType;
514 516
515 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); 517 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_);
516 518
517 // Timestamp of the audio pulled from NetEq. 519 // Timestamp of the audio pulled from NetEq.
518 uint32_t jitter_buffer_playout_timestamp_; 520 uint32_t jitter_buffer_playout_timestamp_;
519 uint32_t playout_timestamp_rtp_; 521 uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_);
520 uint32_t playout_timestamp_rtcp_; 522 uint32_t playout_timestamp_rtcp_;
Henrik Grunell WebRTC 2015/08/12 15:03:22 Protect also?
Taylor Brandstetter 2015/08/12 19:49:04 I don't think it needs to be protected (at least n
Henrik Grunell WebRTC 2015/08/13 08:25:02 Acknowledged.
521 uint32_t playout_delay_ms_; 523 uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_);
522 uint32_t _numberOfDiscardedPackets; 524 uint32_t _numberOfDiscardedPackets;
523 uint16_t send_sequence_number_; 525 uint16_t send_sequence_number_;
524 uint8_t restored_packet_[kVoiceEngineMaxIpPacketSizeBytes]; 526 uint8_t restored_packet_[kVoiceEngineMaxIpPacketSizeBytes];
525 527
526 rtc::scoped_ptr<CriticalSectionWrapper> ts_stats_lock_; 528 rtc::scoped_ptr<CriticalSectionWrapper> ts_stats_lock_;
527 529
528 rtc::scoped_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_; 530 rtc::scoped_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
529 // The rtp timestamp of the first played out audio frame. 531 // The rtp timestamp of the first played out audio frame.
530 int64_t capture_start_rtp_time_stamp_; 532 int64_t capture_start_rtp_time_stamp_;
531 // The capture ntp time (in local timebase) of the first played out audio 533 // The capture ntp time (in local timebase) of the first played out audio
(...skipping 25 matching lines...) Expand all
557 // VoEDtmf 559 // VoEDtmf
558 bool _playOutbandDtmfEvent; 560 bool _playOutbandDtmfEvent;
559 bool _playInbandDtmfEvent; 561 bool _playInbandDtmfEvent;
560 // VoeRTP_RTCP 562 // VoeRTP_RTCP
561 uint32_t _lastLocalTimeStamp; 563 uint32_t _lastLocalTimeStamp;
562 int8_t _lastPayloadType; 564 int8_t _lastPayloadType;
563 bool _includeAudioLevelIndication; 565 bool _includeAudioLevelIndication;
564 // VoENetwork 566 // VoENetwork
565 AudioFrame::SpeechType _outputSpeechType; 567 AudioFrame::SpeechType _outputSpeechType;
566 // VoEVideoSync 568 // VoEVideoSync
567 uint32_t _average_jitter_buffer_delay_us; 569 rtc::scoped_ptr<CriticalSectionWrapper> video_sync_lock_;
568 int least_required_delay_ms_; 570 uint32_t _average_jitter_buffer_delay_us GUARDED_BY(video_sync_lock_);
569 uint32_t _previousTimestamp; 571 uint32_t _previousTimestamp;
570 uint16_t _recPacketDelayMs; 572 uint16_t _recPacketDelayMs GUARDED_BY(video_sync_lock_);
571 // VoEAudioProcessing 573 // VoEAudioProcessing
572 bool _RxVadDetection; 574 bool _RxVadDetection;
573 bool _rxAgcIsEnabled; 575 bool _rxAgcIsEnabled;
574 bool _rxNsIsEnabled; 576 bool _rxNsIsEnabled;
575 bool restored_packet_in_use_; 577 bool restored_packet_in_use_;
576 // RtcpBandwidthObserver 578 // RtcpBandwidthObserver
577 rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_; 579 rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_;
578 rtc::scoped_ptr<NetworkPredictor> network_predictor_; 580 rtc::scoped_ptr<NetworkPredictor> network_predictor_;
579 // An associated send channel. 581 // An associated send channel.
580 rtc::scoped_ptr<CriticalSectionWrapper> assoc_send_channel_lock_; 582 rtc::scoped_ptr<CriticalSectionWrapper> assoc_send_channel_lock_;
581 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_); 583 ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_);
582 }; 584 };
583 585
584 } // namespace voe 586 } // namespace voe
585 } // namespace webrtc 587 } // namespace webrtc
586 588
587 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ 589 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/voice_engine/channel.cc » ('j') | webrtc/voice_engine/channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698