OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 935 } |
936 | 936 |
937 inline FakeVideoMediaChannel::~FakeVideoMediaChannel() { | 937 inline FakeVideoMediaChannel::~FakeVideoMediaChannel() { |
938 if (engine_) { | 938 if (engine_) { |
939 engine_->UnregisterChannel(this); | 939 engine_->UnregisterChannel(this); |
940 } | 940 } |
941 } | 941 } |
942 | 942 |
943 class FakeDataEngine : public DataEngineInterface { | 943 class FakeDataEngine : public DataEngineInterface { |
944 public: | 944 public: |
945 FakeDataEngine(){}; | 945 FakeDataEngine() : last_channel_type_(DCT_NONE) {} |
946 | 946 |
947 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) { | 947 virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type, |
| 948 const MediaConfig& config) { |
| 949 last_channel_type_ = data_channel_type; |
948 FakeDataMediaChannel* ch = new FakeDataMediaChannel(this, DataOptions()); | 950 FakeDataMediaChannel* ch = new FakeDataMediaChannel(this, DataOptions()); |
949 channels_.push_back(ch); | 951 channels_.push_back(ch); |
950 return ch; | 952 return ch; |
951 } | 953 } |
952 | 954 |
953 FakeDataMediaChannel* GetChannel(size_t index) { | 955 FakeDataMediaChannel* GetChannel(size_t index) { |
954 return (channels_.size() > index) ? channels_[index] : NULL; | 956 return (channels_.size() > index) ? channels_[index] : NULL; |
955 } | 957 } |
956 | 958 |
957 void UnregisterChannel(DataMediaChannel* channel) { | 959 void UnregisterChannel(DataMediaChannel* channel) { |
958 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); | 960 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); |
959 } | 961 } |
960 | 962 |
961 virtual void SetDataCodecs(const std::vector<DataCodec>& data_codecs) { | 963 virtual void SetDataCodecs(const std::vector<DataCodec>& data_codecs) { |
962 data_codecs_ = data_codecs; | 964 data_codecs_ = data_codecs; |
963 } | 965 } |
964 | 966 |
965 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } | 967 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } |
966 | 968 |
| 969 DataChannelType last_channel_type() const { return last_channel_type_; } |
| 970 |
967 private: | 971 private: |
968 std::vector<FakeDataMediaChannel*> channels_; | 972 std::vector<FakeDataMediaChannel*> channels_; |
969 std::vector<DataCodec> data_codecs_; | 973 std::vector<DataCodec> data_codecs_; |
| 974 DataChannelType last_channel_type_; |
970 }; | 975 }; |
971 | 976 |
972 } // namespace cricket | 977 } // namespace cricket |
973 | 978 |
974 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 979 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
OLD | NEW |