Remove VideoEngine class from new VideoEngine API.
The VideoEngine class had minimal use, so it makes more sense to bake its functionality and config into VideoCall for a simpler API. The only thing the VideoEngine class could do was to create VideoCalls. BUG=2224 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2020004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4543 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
d65914360a
commit
fd39e13c80
@ -21,9 +21,25 @@
|
||||
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
||||
#include "webrtc/video_engine/internal/video_receive_stream.h"
|
||||
#include "webrtc/video_engine/internal/video_send_stream.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace newapi {
|
||||
VideoCall* VideoCall::Create(const newapi::VideoCall::Config& config) {
|
||||
webrtc::VideoEngine* video_engine = webrtc::VideoEngine::Create();
|
||||
assert(video_engine != NULL);
|
||||
|
||||
ViEBase* video_engine_base = ViEBase::GetInterface(video_engine);
|
||||
assert(video_engine_base != NULL);
|
||||
if (video_engine_base->Init() != 0) {
|
||||
abort();
|
||||
}
|
||||
video_engine_base->Release();
|
||||
|
||||
return new internal::VideoCall(video_engine, config);
|
||||
}
|
||||
} // namespace newapi
|
||||
|
||||
namespace internal {
|
||||
|
||||
VideoCall::VideoCall(webrtc::VideoEngine* video_engine,
|
||||
@ -44,8 +60,9 @@ VideoCall::VideoCall(webrtc::VideoEngine* video_engine,
|
||||
}
|
||||
|
||||
VideoCall::~VideoCall() {
|
||||
rtp_rtcp_->Release();
|
||||
codec_->Release();
|
||||
rtp_rtcp_->Release();
|
||||
webrtc::VideoEngine::Delete(video_engine_);
|
||||
}
|
||||
|
||||
newapi::PacketReceiver* VideoCall::Receiver() { return this; }
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/video_engine/internal/video_receive_stream.h"
|
||||
#include "webrtc/video_engine/internal/video_send_stream.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
#include "webrtc/video_engine/new_include/video_call.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 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.
|
||||
*/
|
||||
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/internal/video_call.h"
|
||||
#include "webrtc/video_engine/vie_defines.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace internal {
|
||||
|
||||
class VideoEngine : public newapi::VideoEngine {
|
||||
public:
|
||||
explicit VideoEngine(const newapi::VideoEngineConfig& config)
|
||||
: config_(config) {
|
||||
video_engine_ = webrtc::VideoEngine::Create();
|
||||
assert(video_engine_ != NULL);
|
||||
|
||||
ViEBase* video_engine_base = ViEBase::GetInterface(video_engine_);
|
||||
assert(video_engine_base != NULL);
|
||||
if (video_engine_base->Init() != 0) {
|
||||
abort();
|
||||
}
|
||||
video_engine_base->Release();
|
||||
}
|
||||
|
||||
virtual ~VideoEngine() { webrtc::VideoEngine::Delete(video_engine_); }
|
||||
|
||||
virtual newapi::VideoCall* CreateCall(
|
||||
const newapi::VideoCall::Config& config) OVERRIDE {
|
||||
return new VideoCall(video_engine_, config);
|
||||
}
|
||||
|
||||
private:
|
||||
newapi::VideoEngineConfig config_;
|
||||
webrtc::VideoEngine* video_engine_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(VideoEngine);
|
||||
};
|
||||
} // internal
|
||||
|
||||
namespace newapi {
|
||||
|
||||
VideoEngine* VideoEngine::Create(const VideoEngineConfig& engine_config) {
|
||||
return new internal::VideoEngine(engine_config);
|
||||
}
|
||||
|
||||
const char* Version() { return WEBRTC_SVNREVISION " (" BUILDINFO ")"; }
|
||||
} // newapi
|
||||
} // webrtc
|
@ -7,9 +7,8 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -33,29 +32,31 @@ class PacketReceiver {
|
||||
virtual ~PacketReceiver() {}
|
||||
};
|
||||
|
||||
struct VideoEngineConfig {
|
||||
VideoEngineConfig()
|
||||
: voice_engine(NULL), trace_callback(NULL), trace_filter(kTraceNone) {}
|
||||
|
||||
// VoiceEngine used for audio/video synchronization for this VideoEngine.
|
||||
VoiceEngine* voice_engine;
|
||||
|
||||
TraceCallback* trace_callback;
|
||||
uint32_t trace_filter;
|
||||
};
|
||||
|
||||
// A VideoCall instance can contain several send and/or receive streams. All
|
||||
// streams are assumed to have the same remote endpoint and will share bitrate
|
||||
// estimates etc.
|
||||
class VideoCall {
|
||||
public:
|
||||
struct Config {
|
||||
Config() : send_transport(NULL), overuse_detection(false) {}
|
||||
explicit Config(Transport* send_transport)
|
||||
: send_transport(send_transport),
|
||||
overuse_detection(false),
|
||||
voice_engine(NULL),
|
||||
trace_callback(NULL),
|
||||
trace_filter(kTraceNone) {}
|
||||
|
||||
Transport* send_transport;
|
||||
bool overuse_detection;
|
||||
|
||||
// VoiceEngine used for audio/video synchronization for this VideoCall.
|
||||
VoiceEngine* voice_engine;
|
||||
|
||||
TraceCallback* trace_callback;
|
||||
uint32_t trace_filter;
|
||||
};
|
||||
|
||||
static VideoCall* Create(const VideoCall::Config& config);
|
||||
|
||||
virtual std::vector<VideoCodec> GetVideoCodecs() = 0;
|
||||
|
||||
virtual VideoSendStream::Config GetDefaultSendConfig() = 0;
|
||||
@ -89,18 +90,7 @@ class VideoCall {
|
||||
|
||||
virtual ~VideoCall() {}
|
||||
};
|
||||
|
||||
// VideoEngine is the main class and there is only one instance serving several
|
||||
// calls.
|
||||
class VideoEngine {
|
||||
public:
|
||||
static VideoEngine* Create(const VideoEngineConfig& config);
|
||||
virtual ~VideoEngine() {}
|
||||
|
||||
virtual VideoCall* CreateCall(const VideoCall::Config& config) = 0;
|
||||
};
|
||||
|
||||
} // namespace newapi
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_
|
||||
#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_
|
@ -10,7 +10,7 @@
|
||||
#include "webrtc/video_engine/test/common/direct_transport.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
#include "webrtc/video_engine/new_include/video_call.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
#include "webrtc/video_engine/new_include/video_call.h"
|
||||
#include "webrtc/video_engine/test/common/direct_transport.h"
|
||||
#include "webrtc/video_engine/test/common/frame_generator.h"
|
||||
#include "webrtc/video_engine/test/common/frame_generator_capturer.h"
|
||||
@ -174,16 +174,13 @@ struct EngineTestParams {
|
||||
class EngineTest : public ::testing::TestWithParam<EngineTestParams> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
video_engine_.reset(
|
||||
newapi::VideoEngine::Create(newapi::VideoEngineConfig()));
|
||||
reserved_ssrcs_.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
newapi::VideoCall* CreateTestCall(newapi::Transport* transport) {
|
||||
newapi::VideoCall::Config call_config;
|
||||
call_config.send_transport = transport;
|
||||
return video_engine_->CreateCall(call_config);
|
||||
newapi::VideoCall::Config call_config(transport);
|
||||
return newapi::VideoCall::Create(call_config);
|
||||
}
|
||||
|
||||
newapi::VideoSendStream::Config CreateTestSendConfig(
|
||||
@ -212,7 +209,6 @@ class EngineTest : public ::testing::TestWithParam<EngineTestParams> {
|
||||
30);
|
||||
}
|
||||
|
||||
scoped_ptr<newapi::VideoEngine> video_engine_;
|
||||
std::map<uint32_t, bool> reserved_ssrcs_;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
#include "webrtc/video_engine/new_include/video_call.h"
|
||||
#include "webrtc/video_engine/test/common/direct_transport.h"
|
||||
#include "webrtc/video_engine/test/common/file_capturer.h"
|
||||
#include "webrtc/video_engine/test/common/frame_generator_capturer.h"
|
||||
@ -270,9 +270,6 @@ TEST_P(FullStackTest, NoPacketLoss) {
|
||||
scoped_ptr<test::VideoRenderer> loopback_video(test::VideoRenderer::Create(
|
||||
"Loopback Video", params.clip.width, params.clip.height));
|
||||
|
||||
scoped_ptr<newapi::VideoEngine> video_engine(
|
||||
newapi::VideoEngine::Create(newapi::VideoEngineConfig()));
|
||||
|
||||
test::DirectTransport transport;
|
||||
VideoAnalyzer analyzer(
|
||||
NULL,
|
||||
@ -283,10 +280,9 @@ TEST_P(FullStackTest, NoPacketLoss) {
|
||||
params.avg_ssim_threshold,
|
||||
static_cast<uint64_t>(FLAGS_seconds * params.clip.fps));
|
||||
|
||||
newapi::VideoCall::Config call_config;
|
||||
call_config.send_transport = &analyzer;
|
||||
newapi::VideoCall::Config call_config(&analyzer);
|
||||
|
||||
scoped_ptr<newapi::VideoCall> call(video_engine->CreateCall(call_config));
|
||||
scoped_ptr<newapi::VideoCall> call(newapi::VideoCall::Create(call_config));
|
||||
analyzer.receiver_ = call->Receiver();
|
||||
transport.SetReceiver(&analyzer);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
#include "webrtc/video_engine/new_include/video_engine.h"
|
||||
#include "webrtc/video_engine/new_include/video_call.h"
|
||||
#include "webrtc/video_engine/test/common/direct_transport.h"
|
||||
#include "webrtc/video_engine/test/common/flags.h"
|
||||
#include "webrtc/video_engine/test/common/generate_ssrcs.h"
|
||||
@ -39,14 +39,10 @@ TEST_F(LoopbackTest, Test) {
|
||||
scoped_ptr<test::VideoRenderer> loopback_video(test::VideoRenderer::Create(
|
||||
"Loopback Video", test::flags::Width(), test::flags::Height()));
|
||||
|
||||
scoped_ptr<newapi::VideoEngine> video_engine(
|
||||
newapi::VideoEngine::Create(webrtc::newapi::VideoEngineConfig()));
|
||||
|
||||
test::DirectTransport transport;
|
||||
newapi::VideoCall::Config call_config;
|
||||
call_config.send_transport = &transport;
|
||||
newapi::VideoCall::Config call_config(&transport);
|
||||
call_config.overuse_detection = true;
|
||||
scoped_ptr<newapi::VideoCall> call(video_engine->CreateCall(call_config));
|
||||
scoped_ptr<newapi::VideoCall> call(newapi::VideoCall::Create(call_config));
|
||||
|
||||
// Loopback, call sends to itself.
|
||||
transport.SetReceiver(call->Receiver());
|
||||
|
@ -117,7 +117,6 @@
|
||||
# New VideoEngine API
|
||||
'internal/video_call.cc',
|
||||
'internal/video_call.h',
|
||||
'internal/video_engine.cc',
|
||||
'internal/video_receive_stream.cc',
|
||||
'internal/video_receive_stream.h',
|
||||
'internal/video_send_stream.cc',
|
||||
@ -125,7 +124,7 @@
|
||||
'new_include/config.h',
|
||||
'new_include/frame_callback.h',
|
||||
'new_include/transport.h',
|
||||
'new_include/video_engine.h',
|
||||
'new_include/video_call.h',
|
||||
'new_include/video_receive_stream.h',
|
||||
'new_include/video_renderer.h',
|
||||
'new_include/video_send_stream.h',
|
||||
|
Loading…
x
Reference in New Issue
Block a user