OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace webrtc { | 32 namespace webrtc { |
33 | 33 |
34 const char MediaStreamTrackInterface::kVideoKind[] = "video"; | 34 const char MediaStreamTrackInterface::kVideoKind[] = "video"; |
35 | 35 |
36 VideoTrack::VideoTrack(const std::string& label, | 36 VideoTrack::VideoTrack(const std::string& label, |
37 VideoSourceInterface* video_source) | 37 VideoSourceInterface* video_source) |
38 : MediaStreamTrack<VideoTrackInterface>(label), | 38 : MediaStreamTrack<VideoTrackInterface>(label), |
39 video_source_(video_source) { | 39 video_source_(video_source) { |
40 if (video_source_) | 40 if (video_source_) |
41 video_source_->AddSink(&renderers_); | 41 video_source_->AddSink(&sinks_); |
42 } | 42 } |
43 | 43 |
44 VideoTrack::~VideoTrack() { | 44 VideoTrack::~VideoTrack() { |
45 if (video_source_) | 45 if (video_source_) |
46 video_source_->RemoveSink(&renderers_); | 46 video_source_->RemoveSink(&sinks_); |
47 } | 47 } |
48 | 48 |
49 std::string VideoTrack::kind() const { | 49 std::string VideoTrack::kind() const { |
50 return kVideoKind; | 50 return kVideoKind; |
51 } | 51 } |
52 | 52 |
53 void VideoTrack::AddRenderer(VideoRendererInterface* renderer) { | 53 void VideoTrack::AddSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { |
54 renderers_.AddRenderer(renderer); | 54 sinks_.AddSink(sink); |
55 } | 55 } |
56 | 56 |
57 void VideoTrack::RemoveRenderer(VideoRendererInterface* renderer) { | 57 void VideoTrack::RemoveSink( |
58 renderers_.RemoveRenderer(renderer); | 58 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { |
| 59 sinks_.RemoveSink(sink); |
59 } | 60 } |
60 | 61 |
61 bool VideoTrack::set_enabled(bool enable) { | 62 bool VideoTrack::set_enabled(bool enable) { |
62 renderers_.SetEnabled(enable); | 63 sinks_.SetEnabled(enable); |
63 return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable); | 64 return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable); |
64 } | 65 } |
65 | 66 |
66 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( | 67 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( |
67 const std::string& id, VideoSourceInterface* source) { | 68 const std::string& id, VideoSourceInterface* source) { |
68 rtc::RefCountedObject<VideoTrack>* track = | 69 rtc::RefCountedObject<VideoTrack>* track = |
69 new rtc::RefCountedObject<VideoTrack>(id, source); | 70 new rtc::RefCountedObject<VideoTrack>(id, source); |
70 return track; | 71 return track; |
71 } | 72 } |
72 | 73 |
73 } // namespace webrtc | 74 } // namespace webrtc |
OLD | NEW |