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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 : id_(track_id), | 74 : id_(track_id), |
75 ssrc_(ssrc), | 75 ssrc_(ssrc), |
76 provider_(provider), | 76 provider_(provider), |
77 source_(new RefCountedObject<VideoTrackSource>(&broadcaster_, | 77 source_(new RefCountedObject<VideoTrackSource>(&broadcaster_, |
78 worker_thread, | 78 worker_thread, |
79 true /* remote */)), | 79 true /* remote */)), |
80 track_(VideoTrackProxy::Create( | 80 track_(VideoTrackProxy::Create( |
81 rtc::Thread::Current(), | 81 rtc::Thread::Current(), |
82 VideoTrack::Create(track_id, source_.get()))) { | 82 VideoTrack::Create(track_id, source_.get()))) { |
83 source_->SetState(MediaSourceInterface::kLive); | 83 source_->SetState(MediaSourceInterface::kLive); |
84 // TODO(perkj): It should be enough to set the source state. All tracks | |
85 // belonging to the same source should get its state from the source. | |
86 // I.e. if a track has been cloned from a remote source. | |
87 track_->set_state(webrtc::MediaStreamTrackInterface::kLive); | |
88 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); | 84 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); |
89 stream->AddTrack(track_); | 85 stream->AddTrack(track_); |
90 } | 86 } |
91 | 87 |
92 VideoRtpReceiver::~VideoRtpReceiver() { | 88 VideoRtpReceiver::~VideoRtpReceiver() { |
93 // Since cricket::VideoRenderer is not reference counted, | 89 // Since cricket::VideoRenderer is not reference counted, |
94 // we need to remove it from the provider before we are deleted. | 90 // we need to remove it from the provider before we are deleted. |
95 Stop(); | 91 Stop(); |
96 } | 92 } |
97 | 93 |
98 void VideoRtpReceiver::Stop() { | 94 void VideoRtpReceiver::Stop() { |
99 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 95 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
100 if (!provider_) { | 96 if (!provider_) { |
101 return; | 97 return; |
102 } | 98 } |
103 source_->SetState(MediaSourceInterface::kEnded); | 99 source_->SetState(MediaSourceInterface::kEnded); |
104 source_->OnSourceDestroyed(); | 100 source_->OnSourceDestroyed(); |
105 // TODO(perkj): It should be enough to set the source state. All tracks | |
106 // belonging to the same source should get its state from the source. | |
107 track_->set_state(MediaStreamTrackInterface::kEnded); | |
108 provider_->SetVideoPlayout(ssrc_, false, nullptr); | 101 provider_->SetVideoPlayout(ssrc_, false, nullptr); |
109 provider_ = nullptr; | 102 provider_ = nullptr; |
110 } | 103 } |
111 | 104 |
112 } // namespace webrtc | 105 } // namespace webrtc |
OLD | NEW |