(Auto)update libjingle 66541346-> 66556498
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6088 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
02b286bfc9
commit
ca27236272
@ -34,6 +34,7 @@
|
|||||||
#include "talk/media/base/screencastid.h"
|
#include "talk/media/base/screencastid.h"
|
||||||
#include "talk/p2p/base/parsing.h"
|
#include "talk/p2p/base/parsing.h"
|
||||||
#include "talk/session/media/call.h"
|
#include "talk/session/media/call.h"
|
||||||
|
#include "talk/session/media/currentspeakermonitor.h"
|
||||||
#include "talk/session/media/mediasessionclient.h"
|
#include "talk/session/media/mediasessionclient.h"
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
@ -74,6 +75,22 @@ bool ContentContainsCrypto(const cricket::ContentInfo* content) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioSourceProxy::AudioSourceProxy(Call* call)
|
||||||
|
: call_(call) {
|
||||||
|
call_->SignalAudioMonitor.connect(this, &AudioSourceProxy::OnAudioMonitor);
|
||||||
|
call_->SignalMediaStreamsUpdate.connect(
|
||||||
|
this, &AudioSourceProxy::OnMediaStreamsUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioSourceProxy::OnAudioMonitor(Call* call, const AudioInfo& info) {
|
||||||
|
SignalAudioMonitor(this, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioSourceProxy::OnMediaStreamsUpdate(Call* call, Session* session,
|
||||||
|
const MediaStreams& added, const MediaStreams& removed) {
|
||||||
|
SignalMediaStreamsUpdate(this, session, added, removed);
|
||||||
|
}
|
||||||
|
|
||||||
Call::Call(MediaSessionClient* session_client)
|
Call::Call(MediaSessionClient* session_client)
|
||||||
: id_(talk_base::CreateRandomId()),
|
: id_(talk_base::CreateRandomId()),
|
||||||
session_client_(session_client),
|
session_client_(session_client),
|
||||||
@ -84,6 +101,7 @@ Call::Call(MediaSessionClient* session_client)
|
|||||||
video_muted_(false),
|
video_muted_(false),
|
||||||
send_to_voicemail_(true),
|
send_to_voicemail_(true),
|
||||||
playing_dtmf_(false) {
|
playing_dtmf_(false) {
|
||||||
|
audio_source_proxy_.reset(new AudioSourceProxy(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
Call::~Call() {
|
Call::~Call() {
|
||||||
@ -718,7 +736,8 @@ void Call::StartSpeakerMonitor(Session* session) {
|
|||||||
StartAudioMonitor(session, kAudioMonitorPollPeriodMillis);
|
StartAudioMonitor(session, kAudioMonitorPollPeriodMillis);
|
||||||
}
|
}
|
||||||
CurrentSpeakerMonitor* speaker_monitor =
|
CurrentSpeakerMonitor* speaker_monitor =
|
||||||
new cricket::CurrentSpeakerMonitor(this, session);
|
new cricket::CurrentSpeakerMonitor(
|
||||||
|
audio_source_proxy_.get(), session);
|
||||||
speaker_monitor->SignalUpdate.connect(this, &Call::OnSpeakerMonitor);
|
speaker_monitor->SignalUpdate.connect(this, &Call::OnSpeakerMonitor);
|
||||||
speaker_monitor->Start();
|
speaker_monitor->Start();
|
||||||
speaker_monitor_map_[session->id()] = speaker_monitor;
|
speaker_monitor_map_[session->id()] = speaker_monitor;
|
||||||
@ -1104,4 +1123,8 @@ Session* Call::InternalInitiateSession(const std::string& id,
|
|||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioSourceProxy* Call::GetAudioSourceProxy() {
|
||||||
|
return audio_source_proxy_.get();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace cricket
|
} // namespace cricket
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
|
||||||
|
struct AudioInfo;
|
||||||
class MediaSessionClient;
|
class MediaSessionClient;
|
||||||
class BaseChannel;
|
class BaseChannel;
|
||||||
class VoiceChannel;
|
class VoiceChannel;
|
||||||
@ -58,6 +59,26 @@ class DataChannel;
|
|||||||
struct CallOptions : public MediaSessionOptions {
|
struct CallOptions : public MediaSessionOptions {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// CurrentSpeakerMonitor used to have a dependency on Call. To remove this
|
||||||
|
// dependency, we create AudioSourceContext. CurrentSpeakerMonitor depends on
|
||||||
|
// AudioSourceContext.
|
||||||
|
// AudioSourceProxy acts as a proxy so that when SignalAudioMonitor
|
||||||
|
// in Call is triggered, SignalAudioMonitor in AudioSourceContext is triggered.
|
||||||
|
// Likewise, when OnMediaStreamsUpdate in Call is triggered,
|
||||||
|
// OnMediaStreamsUpdate in AudioSourceContext is triggered.
|
||||||
|
class AudioSourceProxy: public AudioSourceContext, public sigslot::has_slots<> {
|
||||||
|
public:
|
||||||
|
explicit AudioSourceProxy(Call* call);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnAudioMonitor(Call* call, const AudioInfo& info);
|
||||||
|
void OnMediaStreamsUpdate(Call* call, cricket::Session*,
|
||||||
|
const cricket::MediaStreams&, const cricket::MediaStreams&);
|
||||||
|
|
||||||
|
AudioSourceContext* audio_source_context_;
|
||||||
|
Call* call_;
|
||||||
|
};
|
||||||
|
|
||||||
class Call : public talk_base::MessageHandler, public sigslot::has_slots<> {
|
class Call : public talk_base::MessageHandler, public sigslot::has_slots<> {
|
||||||
public:
|
public:
|
||||||
explicit Call(MediaSessionClient* session_client);
|
explicit Call(MediaSessionClient* session_client);
|
||||||
@ -167,6 +188,8 @@ class Call : public talk_base::MessageHandler, public sigslot::has_slots<> {
|
|||||||
const ReceiveDataParams&,
|
const ReceiveDataParams&,
|
||||||
const talk_base::Buffer&> SignalDataReceived;
|
const talk_base::Buffer&> SignalDataReceived;
|
||||||
|
|
||||||
|
AudioSourceProxy* GetAudioSourceProxy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMessage(talk_base::Message* message);
|
void OnMessage(talk_base::Message* message);
|
||||||
void OnSessionState(BaseSession* base_session, BaseSession::State state);
|
void OnSessionState(BaseSession* base_session, BaseSession::State state);
|
||||||
@ -276,6 +299,8 @@ class Call : public talk_base::MessageHandler, public sigslot::has_slots<> {
|
|||||||
|
|
||||||
VoiceMediaInfo last_voice_media_info_;
|
VoiceMediaInfo last_voice_media_info_;
|
||||||
|
|
||||||
|
talk_base::scoped_ptr<AudioSourceProxy> audio_source_proxy_;
|
||||||
|
|
||||||
friend class MediaSessionClient;
|
friend class MediaSessionClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,9 +39,10 @@ const int kMaxAudioLevel = 9;
|
|||||||
const int kDefaultMinTimeBetweenSwitches = 1000;
|
const int kDefaultMinTimeBetweenSwitches = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentSpeakerMonitor::CurrentSpeakerMonitor(Call* call, BaseSession* session)
|
CurrentSpeakerMonitor::CurrentSpeakerMonitor(
|
||||||
|
AudioSourceContext* audio_source_context, BaseSession* session)
|
||||||
: started_(false),
|
: started_(false),
|
||||||
call_(call),
|
audio_source_context_(audio_source_context),
|
||||||
session_(session),
|
session_(session),
|
||||||
current_speaker_ssrc_(0),
|
current_speaker_ssrc_(0),
|
||||||
earliest_permitted_switch_time_(0),
|
earliest_permitted_switch_time_(0),
|
||||||
@ -54,9 +55,9 @@ CurrentSpeakerMonitor::~CurrentSpeakerMonitor() {
|
|||||||
|
|
||||||
void CurrentSpeakerMonitor::Start() {
|
void CurrentSpeakerMonitor::Start() {
|
||||||
if (!started_) {
|
if (!started_) {
|
||||||
call_->SignalAudioMonitor.connect(
|
audio_source_context_->SignalAudioMonitor.connect(
|
||||||
this, &CurrentSpeakerMonitor::OnAudioMonitor);
|
this, &CurrentSpeakerMonitor::OnAudioMonitor);
|
||||||
call_->SignalMediaStreamsUpdate.connect(
|
audio_source_context_->SignalMediaStreamsUpdate.connect(
|
||||||
this, &CurrentSpeakerMonitor::OnMediaStreamsUpdate);
|
this, &CurrentSpeakerMonitor::OnMediaStreamsUpdate);
|
||||||
|
|
||||||
started_ = true;
|
started_ = true;
|
||||||
@ -65,8 +66,8 @@ void CurrentSpeakerMonitor::Start() {
|
|||||||
|
|
||||||
void CurrentSpeakerMonitor::Stop() {
|
void CurrentSpeakerMonitor::Stop() {
|
||||||
if (started_) {
|
if (started_) {
|
||||||
call_->SignalAudioMonitor.disconnect(this);
|
audio_source_context_->SignalAudioMonitor.disconnect(this);
|
||||||
call_->SignalMediaStreamsUpdate.disconnect(this);
|
audio_source_context_->SignalMediaStreamsUpdate.disconnect(this);
|
||||||
|
|
||||||
started_ = false;
|
started_ = false;
|
||||||
ssrc_to_speaking_state_map_.clear();
|
ssrc_to_speaking_state_map_.clear();
|
||||||
@ -80,7 +81,8 @@ void CurrentSpeakerMonitor::set_min_time_between_switches(
|
|||||||
min_time_between_switches_ = min_time_between_switches;
|
min_time_between_switches_ = min_time_between_switches;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentSpeakerMonitor::OnAudioMonitor(Call* call, const AudioInfo& info) {
|
void CurrentSpeakerMonitor::OnAudioMonitor(
|
||||||
|
AudioSourceContext* audio_source_context, const AudioInfo& info) {
|
||||||
std::map<uint32, int> active_ssrc_to_level_map;
|
std::map<uint32, int> active_ssrc_to_level_map;
|
||||||
cricket::AudioInfo::StreamList::const_iterator stream_list_it;
|
cricket::AudioInfo::StreamList::const_iterator stream_list_it;
|
||||||
for (stream_list_it = info.active_streams.begin();
|
for (stream_list_it = info.active_streams.begin();
|
||||||
@ -187,11 +189,10 @@ void CurrentSpeakerMonitor::OnAudioMonitor(Call* call, const AudioInfo& info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentSpeakerMonitor::OnMediaStreamsUpdate(Call* call,
|
void CurrentSpeakerMonitor::OnMediaStreamsUpdate(
|
||||||
Session* session,
|
AudioSourceContext* audio_source_context, Session* session,
|
||||||
const MediaStreams& added,
|
const MediaStreams& added, const MediaStreams& removed) {
|
||||||
const MediaStreams& removed) {
|
if (audio_source_context == audio_source_context_ && session == session_) {
|
||||||
if (call == call_ && session == session_) {
|
|
||||||
// Update the speaking state map based on added and removed streams.
|
// Update the speaking state map based on added and removed streams.
|
||||||
for (std::vector<cricket::StreamParams>::const_iterator
|
for (std::vector<cricket::StreamParams>::const_iterator
|
||||||
it = removed.video().begin(); it != removed.video().end(); ++it) {
|
it = removed.video().begin(); it != removed.video().end(); ++it) {
|
||||||
|
@ -44,11 +44,27 @@ class Session;
|
|||||||
struct AudioInfo;
|
struct AudioInfo;
|
||||||
struct MediaStreams;
|
struct MediaStreams;
|
||||||
|
|
||||||
// Note that the call's audio monitor must be started before this is started.
|
class AudioSourceContext {
|
||||||
|
public:
|
||||||
|
sigslot::signal2<AudioSourceContext*, const cricket::AudioInfo&>
|
||||||
|
SignalAudioMonitor;
|
||||||
|
sigslot::signal4<AudioSourceContext*, cricket::Session*,
|
||||||
|
const cricket::MediaStreams&, const cricket::MediaStreams&>
|
||||||
|
SignalMediaStreamsUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
// CurrentSpeakerMonitor can be used to monitor the audio-levels from
|
||||||
|
// many audio-sources and report on changes in the loudest audio-source.
|
||||||
|
// Its a generic type and relies on an AudioSourceContext which is aware of
|
||||||
|
// the audio-sources. AudioSourceContext needs to provide two signals namely
|
||||||
|
// SignalAudioInfoMonitor - provides audio info of the all current speakers.
|
||||||
|
// SignalMediaSourcesUpdated - provides updates when a speaker leaves or joins.
|
||||||
|
// Note that the AudioSourceContext's audio monitor must be started
|
||||||
|
// before this is started.
|
||||||
// It's recommended that the audio monitor be started with a 100 ms period.
|
// It's recommended that the audio monitor be started with a 100 ms period.
|
||||||
class CurrentSpeakerMonitor : public sigslot::has_slots<> {
|
class CurrentSpeakerMonitor : public sigslot::has_slots<> {
|
||||||
public:
|
public:
|
||||||
CurrentSpeakerMonitor(Call* call, BaseSession* session);
|
CurrentSpeakerMonitor(AudioSourceContext* call, BaseSession* session);
|
||||||
~CurrentSpeakerMonitor();
|
~CurrentSpeakerMonitor();
|
||||||
|
|
||||||
BaseSession* session() const { return session_; }
|
BaseSession* session() const { return session_; }
|
||||||
@ -67,8 +83,8 @@ class CurrentSpeakerMonitor : public sigslot::has_slots<> {
|
|||||||
sigslot::signal2<CurrentSpeakerMonitor*, uint32> SignalUpdate;
|
sigslot::signal2<CurrentSpeakerMonitor*, uint32> SignalUpdate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnAudioMonitor(Call* call, const AudioInfo& info);
|
void OnAudioMonitor(AudioSourceContext* call, const AudioInfo& info);
|
||||||
void OnMediaStreamsUpdate(Call* call,
|
void OnMediaStreamsUpdate(AudioSourceContext* call,
|
||||||
Session* session,
|
Session* session,
|
||||||
const MediaStreams& added,
|
const MediaStreams& added,
|
||||||
const MediaStreams& removed);
|
const MediaStreams& removed);
|
||||||
@ -85,7 +101,7 @@ class CurrentSpeakerMonitor : public sigslot::has_slots<> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool started_;
|
bool started_;
|
||||||
Call* call_;
|
AudioSourceContext* audio_source_context_;
|
||||||
BaseSession* session_;
|
BaseSession* session_;
|
||||||
std::map<uint32, SpeakingState> ssrc_to_speaking_state_map_;
|
std::map<uint32, SpeakingState> ssrc_to_speaking_state_map_;
|
||||||
uint32 current_speaker_ssrc_;
|
uint32 current_speaker_ssrc_;
|
||||||
|
@ -47,7 +47,7 @@ class MockCall : public Call {
|
|||||||
MockCall() : Call(NULL) {}
|
MockCall() : Call(NULL) {}
|
||||||
|
|
||||||
void EmitAudioMonitor(const AudioInfo& info) {
|
void EmitAudioMonitor(const AudioInfo& info) {
|
||||||
SignalAudioMonitor(this, info);
|
GetAudioSourceProxy()->SignalAudioMonitor(GetAudioSourceProxy(), info);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class CurrentSpeakerMonitorTest : public testing::Test,
|
|||||||
public:
|
public:
|
||||||
CurrentSpeakerMonitorTest() {
|
CurrentSpeakerMonitorTest() {
|
||||||
call_ = new MockCall();
|
call_ = new MockCall();
|
||||||
monitor_ = new CurrentSpeakerMonitor(call_, NULL);
|
monitor_ = new CurrentSpeakerMonitor(call_->GetAudioSourceProxy(), NULL);
|
||||||
// Shrink the minimum time betweeen switches to 10 ms so we don't have to
|
// Shrink the minimum time betweeen switches to 10 ms so we don't have to
|
||||||
// slow down our tests.
|
// slow down our tests.
|
||||||
monitor_->set_min_time_between_switches(kMinTimeBetweenSwitches);
|
monitor_->set_min_time_between_switches(kMinTimeBetweenSwitches);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user