| Index: webrtc/media/base/hybriddataengine.h
|
| diff --git a/webrtc/media/base/hybriddataengine.h b/webrtc/media/base/hybriddataengine.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..18751bd509f707be0697fd04de3dd4a12137cc60
|
| --- /dev/null
|
| +++ b/webrtc/media/base/hybriddataengine.h
|
| @@ -0,0 +1,59 @@
|
| +/*
|
| + * Copyright 2012 The WebRTC Project Authors. All rights reserved.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license
|
| + * that can be found in the LICENSE file in the root of the source
|
| + * tree. An additional intellectual property rights grant can be found
|
| + * in the file PATENTS. All contributing project authors may
|
| + * be found in the AUTHORS file in the root of the source tree.
|
| + */
|
| +
|
| +#ifndef WEBRTC_MEDIA_BASE_HYBRIDDATAENGINE_H_
|
| +#define WEBRTC_MEDIA_BASE_HYBRIDDATAENGINE_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "webrtc/base/scoped_ptr.h"
|
| +#include "webrtc/media/base/codec.h"
|
| +#include "webrtc/media/base/mediachannel.h"
|
| +#include "webrtc/media/base/mediaengine.h"
|
| +
|
| +namespace cricket {
|
| +
|
| +class HybridDataEngine : public DataEngineInterface {
|
| + public:
|
| + // Takes ownership.
|
| + HybridDataEngine(DataEngineInterface* first,
|
| + DataEngineInterface* second)
|
| + : first_(first),
|
| + second_(second) {
|
| + codecs_ = first_->data_codecs();
|
| + codecs_.insert(
|
| + codecs_.end(),
|
| + second_->data_codecs().begin(),
|
| + second_->data_codecs().end());
|
| + }
|
| +
|
| + virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type) {
|
| + DataMediaChannel* channel = NULL;
|
| + if (first_) {
|
| + channel = first_->CreateChannel(data_channel_type);
|
| + }
|
| + if (!channel && second_) {
|
| + channel = second_->CreateChannel(data_channel_type);
|
| + }
|
| + return channel;
|
| + }
|
| +
|
| + virtual const std::vector<DataCodec>& data_codecs() { return codecs_; }
|
| +
|
| + private:
|
| + rtc::scoped_ptr<DataEngineInterface> first_;
|
| + rtc::scoped_ptr<DataEngineInterface> second_;
|
| + std::vector<DataCodec> codecs_;
|
| +};
|
| +
|
| +} // namespace cricket
|
| +
|
| +#endif // WEBRTC_MEDIA_BASE_HYBRIDDATAENGINE_H_
|
|
|