| 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() : last_channel_type_(DCT_NONE) {} | 945 FakeDataEngine(){}; |
| 946 | 946 |
| 947 virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type, | 947 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) { |
| 948 const MediaConfig& config) { | |
| 949 last_channel_type_ = data_channel_type; | |
| 950 FakeDataMediaChannel* ch = new FakeDataMediaChannel(this, DataOptions()); | 948 FakeDataMediaChannel* ch = new FakeDataMediaChannel(this, DataOptions()); |
| 951 channels_.push_back(ch); | 949 channels_.push_back(ch); |
| 952 return ch; | 950 return ch; |
| 953 } | 951 } |
| 954 | 952 |
| 955 FakeDataMediaChannel* GetChannel(size_t index) { | 953 FakeDataMediaChannel* GetChannel(size_t index) { |
| 956 return (channels_.size() > index) ? channels_[index] : NULL; | 954 return (channels_.size() > index) ? channels_[index] : NULL; |
| 957 } | 955 } |
| 958 | 956 |
| 959 void UnregisterChannel(DataMediaChannel* channel) { | 957 void UnregisterChannel(DataMediaChannel* channel) { |
| 960 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); | 958 channels_.erase(std::find(channels_.begin(), channels_.end(), channel)); |
| 961 } | 959 } |
| 962 | 960 |
| 963 virtual void SetDataCodecs(const std::vector<DataCodec>& data_codecs) { | 961 virtual void SetDataCodecs(const std::vector<DataCodec>& data_codecs) { |
| 964 data_codecs_ = data_codecs; | 962 data_codecs_ = data_codecs; |
| 965 } | 963 } |
| 966 | 964 |
| 967 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } | 965 virtual const std::vector<DataCodec>& data_codecs() { return data_codecs_; } |
| 968 | 966 |
| 969 DataChannelType last_channel_type() const { return last_channel_type_; } | |
| 970 | |
| 971 private: | 967 private: |
| 972 std::vector<FakeDataMediaChannel*> channels_; | 968 std::vector<FakeDataMediaChannel*> channels_; |
| 973 std::vector<DataCodec> data_codecs_; | 969 std::vector<DataCodec> data_codecs_; |
| 974 DataChannelType last_channel_type_; | |
| 975 }; | 970 }; |
| 976 | 971 |
| 977 } // namespace cricket | 972 } // namespace cricket |
| 978 | 973 |
| 979 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ | 974 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ |
| OLD | NEW |