Bug 1099318: Fix for conduit receive then send creation order issue. Now insensitive to order. r=bwc"

This commit is contained in:
Paul Kerr [:pkerr] 2015-01-29 08:52:40 -08:00
Родитель 344fd0a633
Коммит 0dd312ac8c
6 изменённых файлов: 27 добавлений и 18 удалений

Просмотреть файл

@ -234,7 +234,8 @@ public:
* return: Concrete VideoSessionConduitObject or nullptr in the case
* of failure
*/
static RefPtr<VideoSessionConduit> Create(VideoSessionConduit *aOther);
static RefPtr<VideoSessionConduit> Create(VideoSessionConduit *aOther,
bool receiving);
enum FrameRequestType
{

Просмотреть файл

@ -42,13 +42,15 @@ const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
/**
* Factory Method for VideoConduit
*/
mozilla::RefPtr<VideoSessionConduit> VideoSessionConduit::Create(VideoSessionConduit *aOther)
mozilla::RefPtr<VideoSessionConduit>
VideoSessionConduit::Create(VideoSessionConduit *aOther,
bool receiving)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
CSFLogDebug(logTag, "%s ", __FUNCTION__);
WebrtcVideoConduit* obj = new WebrtcVideoConduit();
if(obj->Init(static_cast<WebrtcVideoConduit*>(aOther)) != kMediaConduitNoError)
if(obj->Init(static_cast<WebrtcVideoConduit*>(aOther), receiving) != kMediaConduitNoError)
{
CSFLogError(logTag, "%s VideoConduit Init Failed ", __FUNCTION__);
delete obj;
@ -284,7 +286,9 @@ bool WebrtcVideoConduit::GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
/**
* Performs initialization of the MANDATORY components of the Video Engine
*/
MediaConduitErrorCode WebrtcVideoConduit::Init(WebrtcVideoConduit *other)
MediaConduitErrorCode
WebrtcVideoConduit::Init(WebrtcVideoConduit *other,
bool receiving)
{
CSFLogDebug(logTag, "%s this=%p other=%p", __FUNCTION__, this, other);
@ -343,7 +347,8 @@ MediaConduitErrorCode WebrtcVideoConduit::Init(WebrtcVideoConduit *other)
#endif
// Per WebRTC APIs below function calls return nullptr on failure
if( !(mVideoEngine = webrtc::VideoEngine::Create()) )
mVideoEngine = webrtc::VideoEngine::Create();
if(!mVideoEngine)
{
CSFLogError(logTag, "%s Unable to create video engine ", __FUNCTION__);
return kMediaConduitSessionNotInited;
@ -444,14 +449,6 @@ MediaConduitErrorCode WebrtcVideoConduit::Init(WebrtcVideoConduit *other)
__FUNCTION__,mPtrViEBase->LastError());
return kMediaConduitCaptureError;
}
if(mPtrViERender->AddRenderer(mChannel,
webrtc::kVideoI420,
(webrtc::ExternalRenderer*) this) == -1)
{
CSFLogError(logTag, "%s Failed to added external renderer ", __FUNCTION__);
return kMediaConduitInvalidRenderer;
}
// Set up some parameters, per juberti. Set MTU.
if(mPtrViENetwork->SetMTU(mChannel, 1200) != 0)
{
@ -468,6 +465,15 @@ MediaConduitErrorCode WebrtcVideoConduit::Init(WebrtcVideoConduit *other)
}
}
if (receiving) {
if (mPtrViERender->AddRenderer(mChannel,
webrtc::kVideoI420,
(webrtc::ExternalRenderer*) this) == -1) {
CSFLogError(logTag, "%s Failed to added external renderer ", __FUNCTION__);
return kMediaConduitInvalidRenderer;
}
}
CSFLogError(logTag, "%s Initialization Done", __FUNCTION__);
return kMediaConduitNoError;
}

Просмотреть файл

@ -226,7 +226,8 @@ public:
WebrtcVideoConduit();
virtual ~WebrtcVideoConduit();
MediaConduitErrorCode Init(WebrtcVideoConduit *other);
MediaConduitErrorCode Init(WebrtcVideoConduit *other,
bool receiving);
int GetChannel() { return mChannel; }
webrtc::VideoEngine* GetVideoEngine() { return mVideoEngine; }

Просмотреть файл

@ -608,7 +608,7 @@ MediaPipelineFactory::CreateVideoConduit(const JsepTrackPair& aTrackPair,
// The two sides of a send/receive pair of conduits each keep a raw
// pointer to the other, and are responsible for cleanly shutting down.
RefPtr<VideoSessionConduit> conduit = VideoSessionConduit::Create(
static_cast<VideoSessionConduit*>(peerConduit.get()));
static_cast<VideoSessionConduit*>(peerConduit.get()), receiving);
if (!conduit) {
MOZ_MTLOG(ML_ERROR, "Could not create video conduit");

Просмотреть файл

@ -318,9 +318,6 @@ nsresult PeerConnectionMedia::UpdateMediaPipelines(
return rv;
}
// TODO(bug 1099318): We are forced to do receive then transmit, because of
// a bug in the VideoConduit code. This will need to be fixed for
// renegotiation.
if (pair->mReceiving) {
rv = factory.CreateMediaPipeline(*pair, *pair->mReceiving);
if (NS_FAILED(rv)) {

Просмотреть файл

@ -595,6 +595,7 @@ class TransportConduitTest : public ::testing::Test
WrapRunnableNMRet(
&mozilla::VideoSessionConduit::Create,
nullptr,
false,
&mVideoSession));
if( !mVideoSession )
ASSERT_NE(mVideoSession, (void*)nullptr);
@ -604,6 +605,7 @@ class TransportConduitTest : public ::testing::Test
WrapRunnableNMRet(
&mozilla::VideoSessionConduit::Create,
nullptr,
true,
&mVideoSession2));
if( !mVideoSession2 )
ASSERT_NE(mVideoSession2,(void*)nullptr);
@ -695,6 +697,7 @@ class TransportConduitTest : public ::testing::Test
WrapRunnableNMRet(
&mozilla::VideoSessionConduit::Create,
nullptr,
true,
&videoSession));
if( !videoSession )
ASSERT_NE(videoSession, (void*)nullptr);
@ -807,6 +810,7 @@ class TransportConduitTest : public ::testing::Test
WrapRunnableNMRet(
&mozilla::VideoSessionConduit::Create,
nullptr,
false,
&mVideoSession));
if( !mVideoSession )
ASSERT_NE(mVideoSession, (void*)nullptr);