OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 uint32_t ssrc, | 78 uint32_t ssrc, |
79 VideoProviderInterface* provider) | 79 VideoProviderInterface* provider) |
80 : id_(track_id), | 80 : id_(track_id), |
81 ssrc_(ssrc), | 81 ssrc_(ssrc), |
82 provider_(provider), | 82 provider_(provider), |
83 source_(new RefCountedObject<VideoTrackSource>(&broadcaster_, | 83 source_(new RefCountedObject<VideoTrackSource>(&broadcaster_, |
84 worker_thread, | 84 worker_thread, |
85 true /* remote */)), | 85 true /* remote */)), |
86 track_(VideoTrackProxy::Create( | 86 track_(VideoTrackProxy::Create( |
87 rtc::Thread::Current(), | 87 rtc::Thread::Current(), |
| 88 worker_thread, |
88 VideoTrack::Create(track_id, source_.get()))) { | 89 VideoTrack::Create(track_id, source_.get()))) { |
89 source_->SetState(MediaSourceInterface::kLive); | 90 source_->SetState(MediaSourceInterface::kLive); |
90 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); | 91 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); |
91 stream->AddTrack(track_); | 92 stream->AddTrack(track_); |
92 } | 93 } |
93 | 94 |
94 VideoRtpReceiver::~VideoRtpReceiver() { | 95 VideoRtpReceiver::~VideoRtpReceiver() { |
95 // Since cricket::VideoRenderer is not reference counted, | 96 // Since cricket::VideoRenderer is not reference counted, |
96 // we need to remove it from the provider before we are deleted. | 97 // we need to remove it from the provider before we are deleted. |
97 Stop(); | 98 Stop(); |
98 } | 99 } |
99 | 100 |
100 void VideoRtpReceiver::Stop() { | 101 void VideoRtpReceiver::Stop() { |
101 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 102 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
102 if (!provider_) { | 103 if (!provider_) { |
103 return; | 104 return; |
104 } | 105 } |
105 source_->SetState(MediaSourceInterface::kEnded); | 106 source_->SetState(MediaSourceInterface::kEnded); |
106 source_->OnSourceDestroyed(); | 107 source_->OnSourceDestroyed(); |
107 provider_->SetVideoPlayout(ssrc_, false, nullptr); | 108 provider_->SetVideoPlayout(ssrc_, false, nullptr); |
108 provider_ = nullptr; | 109 provider_ = nullptr; |
109 } | 110 } |
110 | 111 |
111 } // namespace webrtc | 112 } // namespace webrtc |
OLD | NEW |