Make sure channels in the same call are in the same channel group.

Tested manually. I'll make a follow CL with a proper test once review.webrtc.org/5619004 has been committed.

R=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/5509004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5280 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2013-12-13 09:40:45 +00:00
parent e9abd591d7
commit f3973e81d5
6 changed files with 49 additions and 24 deletions

View File

@ -78,9 +78,11 @@ class Call : public webrtc::Call, public PacketReceiver {
scoped_ptr<RtpHeaderParser> rtp_header_parser_;
webrtc::VideoEngine* video_engine_;
VideoEngine* video_engine_;
ViERTP_RTCP* rtp_rtcp_;
ViECodec* codec_;
ViEBase* base_;
int base_channel_id_;
DISALLOW_COPY_AND_ASSIGN(Call);
};
@ -182,7 +184,8 @@ Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
receive_lock_(RWLockWrapper::CreateRWLock()),
send_lock_(RWLockWrapper::CreateRWLock()),
rtp_header_parser_(RtpHeaderParser::Create()),
video_engine_(video_engine) {
video_engine_(video_engine),
base_channel_id_(-1) {
assert(video_engine != NULL);
assert(config.send_transport != NULL);
@ -193,10 +196,20 @@ Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
codec_ = ViECodec::GetInterface(video_engine_);
assert(codec_ != NULL);
// As a workaround for non-existing calls in the old API, create a base
// channel used as default channel when creating send and receive streams.
base_ = ViEBase::GetInterface(video_engine_);
assert(base_ != NULL);
base_->CreateChannel(base_channel_id_);
assert(base_channel_id_ != -1);
}
Call::~Call() {
global_trace_dispatcher->DeregisterCallback(this);
base_->DeleteChannel(base_channel_id_);
base_->Release();
codec_->Release();
rtp_rtcp_->Release();
webrtc::VideoEngine::Delete(video_engine_);
@ -227,8 +240,11 @@ VideoSendStream* Call::CreateVideoSendStream(
assert(config.rtp.ssrcs.size() > 0);
assert(config.rtp.ssrcs.size() >= config.codec.numberOfSimulcastStreams);
VideoSendStream* send_stream = new VideoSendStream(
config_.send_transport, config_.overuse_detection, video_engine_, config);
VideoSendStream* send_stream = new VideoSendStream(config_.send_transport,
config_.overuse_detection,
video_engine_,
config,
base_channel_id_);
WriteLockScoped write_lock(*send_lock_);
for (size_t i = 0; i < config.rtp.ssrcs.size(); ++i) {
@ -266,8 +282,12 @@ VideoReceiveStream::Config Call::GetDefaultReceiveConfig() {
VideoReceiveStream* Call::CreateVideoReceiveStream(
const VideoReceiveStream::Config& config) {
VideoReceiveStream* receive_stream = new VideoReceiveStream(
video_engine_, config, config_.send_transport, config_.voice_engine);
VideoReceiveStream* receive_stream =
new VideoReceiveStream(video_engine_,
config,
config_.send_transport,
config_.voice_engine,
base_channel_id_);
WriteLockScoped write_lock(*receive_lock_);
assert(receive_ssrcs_.find(config.rtp.remote_ssrc) == receive_ssrcs_.end());

View File

@ -31,14 +31,14 @@ namespace internal {
VideoReceiveStream::VideoReceiveStream(webrtc::VideoEngine* video_engine,
const VideoReceiveStream::Config& config,
newapi::Transport* transport,
webrtc::VoiceEngine* voice_engine)
webrtc::VoiceEngine* voice_engine,
int base_channel)
: transport_adapter_(transport),
encoded_frame_proxy_(config.pre_decode_callback),
config_(config),
channel_(-1) {
video_engine_base_ = ViEBase::GetInterface(video_engine);
// TODO(mflodman): Use the other CreateChannel method.
video_engine_base_->CreateChannel(channel_);
video_engine_base_->CreateReceiveChannel(channel_, base_channel);
assert(channel_ != -1);
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine);
@ -174,5 +174,5 @@ int32_t VideoReceiveStream::RenderFrame(const uint32_t stream_id,
video_frame, video_frame.render_time_ms() - clock_->TimeInMilliseconds());
return 0;
}
} // internal
} // webrtc
} // namespace internal
} // namespace webrtc

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_VIDEO_RECEIVE_STREAM_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_VIDEO_RECEIVE_STREAM_IMPL_H_
#ifndef WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_
#define WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_
#include <vector>
@ -41,7 +41,8 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
VideoReceiveStream(webrtc::VideoEngine* video_engine,
const VideoReceiveStream::Config& config,
newapi::Transport* transport,
webrtc::VoiceEngine* voice_engine);
webrtc::VoiceEngine* voice_engine,
int base_channel);
virtual ~VideoReceiveStream();
virtual void StartReceiving() OVERRIDE;
@ -72,7 +73,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
int channel_;
};
} // internal
} // webrtc
} // namespace internal
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_INTERNAL_VIDEO_RECEIVE_STREAM_H_
#endif // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_

View File

@ -81,14 +81,16 @@ class ResolutionAdaptor : public webrtc::CpuOveruseObserver {
VideoSendStream::VideoSendStream(newapi::Transport* transport,
bool overuse_detection,
webrtc::VideoEngine* video_engine,
const VideoSendStream::Config& config)
const VideoSendStream::Config& config,
int base_channel)
: transport_adapter_(transport),
encoded_frame_proxy_(config.post_encode_callback),
codec_lock_(CriticalSectionWrapper::CreateCriticalSection()),
config_(config),
external_codec_(NULL) {
external_codec_(NULL),
channel_(-1) {
video_engine_base_ = ViEBase::GetInterface(video_engine);
video_engine_base_->CreateChannel(channel_);
video_engine_base_->CreateChannel(channel_, base_channel);
assert(channel_ != -1);
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine);

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_ENGINE_VIDEO_SEND_STREAM_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_VIDEO_SEND_STREAM_IMPL_H_
#ifndef WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
#include <vector>
@ -42,7 +42,8 @@ class VideoSendStream : public webrtc::VideoSendStream,
VideoSendStream(newapi::Transport* transport,
bool overuse_detection,
webrtc::VideoEngine* video_engine,
const VideoSendStream::Config& config);
const VideoSendStream::Config& config,
int base_channel);
virtual ~VideoSendStream();
@ -85,4 +86,4 @@ class VideoSendStream : public webrtc::VideoSendStream,
} // namespace internal
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_INTERNAL_VIDEO_SEND_STREAM_H_
#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_

View File

@ -12,6 +12,7 @@
#include <sstream>
#include <string>
#include <utility>
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"