| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 14 matching lines...) Expand all Loading... |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/app/webrtc/rtpreceiver.h" | 28 #include "talk/app/webrtc/rtpreceiver.h" |
| 29 | 29 |
| 30 #include "talk/app/webrtc/videosourceinterface.h" | 30 #include "talk/app/webrtc/videosourceinterface.h" |
| 31 | 31 |
| 32 namespace webrtc { | 32 namespace webrtc { |
| 33 | 33 |
| 34 AudioRtpReceiver::AudioRtpReceiver(AudioTrackInterface* track, | 34 AudioRtpReceiver::AudioRtpReceiver(AudioTrackInterface* track, |
| 35 uint32 ssrc, | 35 uint32_t ssrc, |
| 36 AudioProviderInterface* provider) | 36 AudioProviderInterface* provider) |
| 37 : id_(track->id()), | 37 : id_(track->id()), |
| 38 track_(track), | 38 track_(track), |
| 39 ssrc_(ssrc), | 39 ssrc_(ssrc), |
| 40 provider_(provider), | 40 provider_(provider), |
| 41 cached_track_enabled_(track->enabled()) { | 41 cached_track_enabled_(track->enabled()) { |
| 42 track_->RegisterObserver(this); | 42 track_->RegisterObserver(this); |
| 43 track_->GetSource()->RegisterAudioObserver(this); | 43 track_->GetSource()->RegisterAudioObserver(this); |
| 44 Reconfigure(); | 44 Reconfigure(); |
| 45 } | 45 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AudioRtpReceiver::Reconfigure() { | 77 void AudioRtpReceiver::Reconfigure() { |
| 78 if (!provider_) { | 78 if (!provider_) { |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 provider_->SetAudioPlayout(ssrc_, track_->enabled(), track_->GetRenderer()); | 81 provider_->SetAudioPlayout(ssrc_, track_->enabled(), track_->GetRenderer()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 VideoRtpReceiver::VideoRtpReceiver(VideoTrackInterface* track, | 84 VideoRtpReceiver::VideoRtpReceiver(VideoTrackInterface* track, |
| 85 uint32 ssrc, | 85 uint32_t ssrc, |
| 86 VideoProviderInterface* provider) | 86 VideoProviderInterface* provider) |
| 87 : id_(track->id()), track_(track), ssrc_(ssrc), provider_(provider) { | 87 : id_(track->id()), track_(track), ssrc_(ssrc), provider_(provider) { |
| 88 provider_->SetVideoPlayout(ssrc_, true, track_->GetSource()->FrameInput()); | 88 provider_->SetVideoPlayout(ssrc_, true, track_->GetSource()->FrameInput()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 VideoRtpReceiver::~VideoRtpReceiver() { | 91 VideoRtpReceiver::~VideoRtpReceiver() { |
| 92 // Since cricket::VideoRenderer is not reference counted, | 92 // Since cricket::VideoRenderer is not reference counted, |
| 93 // we need to remove it from the provider before we are deleted. | 93 // we need to remove it from the provider before we are deleted. |
| 94 Stop(); | 94 Stop(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void VideoRtpReceiver::Stop() { | 97 void VideoRtpReceiver::Stop() { |
| 98 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 98 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
| 99 if (!provider_) { | 99 if (!provider_) { |
| 100 return; | 100 return; |
| 101 } | 101 } |
| 102 provider_->SetVideoPlayout(ssrc_, false, nullptr); | 102 provider_->SetVideoPlayout(ssrc_, false, nullptr); |
| 103 provider_ = nullptr; | 103 provider_ = nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace webrtc | 106 } // namespace webrtc |
| OLD | NEW |