Update to the peerconnection sample app.

* Fixes bug where remote video wasn't renderered.


* Update the Conductor class in accordance to the latest changes in the API.
  We now process the stream add/remove callbacks asynchronously.

* When a remote peer connects to us, we now call AddStream for our local streams
  to share with the peer if we haven't already done so.  To do that, we maintain
  a set of streams we have already shared.

BUG=11
Review URL: http://webrtc-codereview.appspot.com/131011

git-svn-id: http://webrtc.googlecode.com/svn/trunk@506 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tommi@webrtc.org
2011-09-01 08:37:05 +00:00
parent 84519ec0a2
commit c6e54a97a7
5 changed files with 165 additions and 130 deletions

View File

@@ -146,6 +146,9 @@ void MainWnd::SwitchToConnectUI() {
}
void MainWnd::SwitchToPeerList(const Peers& peers) {
remote_video_.reset();
local_video_.reset();
LayoutConnectUI(false);
::SendMessage(listbox_, LB_RESETCONTENT, 0, 0);
@@ -161,9 +164,6 @@ void MainWnd::SwitchToPeerList(const Peers& peers) {
}
void MainWnd::SwitchToStreamingUI() {
remote_video_.reset(new VideoRenderer(handle(), 1, 1));
local_video_.reset(new VideoRenderer(handle(), 1, 1));
LayoutConnectUI(false);
LayoutPeerListUI(false);
ui_ = STREAMING;
@@ -177,6 +177,18 @@ void MainWnd::MessageBox(const char* caption, const char* text, bool is_error) {
::MessageBoxA(handle(), text, caption, flags);
}
cricket::VideoRenderer* MainWnd::local_renderer() {
if (!local_video_.get())
local_video_.reset(new VideoRenderer(handle(), 1, 1));
return local_video_.get();
}
cricket::VideoRenderer* MainWnd::remote_renderer() {
if (!remote_video_.get())
remote_video_.reset(new VideoRenderer(handle(), 1, 1));
return remote_video_.get();
}
void MainWnd::QueueUIThreadCallback(int msg_id, void* data) {
::PostThreadMessage(ui_thread_id_, UI_THREAD_CALLBACK,
static_cast<WPARAM>(msg_id), reinterpret_cast<LPARAM>(data));
@@ -194,8 +206,8 @@ void MainWnd::OnPaint() {
AutoLock<VideoRenderer> remote_lock(remote_video_.get());
const BITMAPINFO& bmi = remote_video_->bmi();
long height = abs(bmi.bmiHeader.biHeight);
long width = bmi.bmiHeader.biWidth;
int height = abs(bmi.bmiHeader.biHeight);
int width = bmi.bmiHeader.biWidth;
const uint8* image = remote_video_->image();
if (image != NULL) {
@@ -231,8 +243,8 @@ void MainWnd::OnPaint() {
if ((rc.right - rc.left) > 200 && (rc.bottom - rc.top) > 200) {
const BITMAPINFO& bmi = local_video_->bmi();
image = local_video_->image();
long thumb_width = bmi.bmiHeader.biWidth / 4;
long thumb_height = abs(bmi.bmiHeader.biHeight) / 4;
int thumb_width = bmi.bmiHeader.biWidth / 4;
int thumb_height = abs(bmi.bmiHeader.biHeight) / 4;
StretchDIBits(dc_mem,
logical_area.x - thumb_width - 10,
logical_area.y - thumb_height - 10,