Bug 1056213 - Window title in "windows or screen to share" list is not updated when navigating to another page r=rjesup

This commit is contained in:
Matthew A. Miller 2014-08-27 16:32:28 -06:00
parent 3bd8e95f82
commit f36ccb7397
3 changed files with 22 additions and 1 deletions

View File

@ -267,7 +267,8 @@ MediaEngineWebRTC::EnumerateVideoDevices(MediaSourceType aMediaSource,
nsRefPtr<MediaEngineWebRTCVideoSource> vSource;
NS_ConvertUTF8toUTF16 uuid(uniqueId);
if (mVideoSources.Get(uuid, getter_AddRefs(vSource))) {
// We've already seen this device, just append.
// We've already seen this device, just refresh and append.
vSource->Refresh(i);
aVSources->AppendElement(vSource.get());
} else {
vSource = new MediaEngineWebRTCVideoSource(videoEngine, i, aMediaSource);

View File

@ -214,6 +214,8 @@ public:
return NS_OK;
}
void Refresh(int aIndex);
protected:
~MediaEngineWebRTCVideoSource() { Shutdown(); }

View File

@ -700,6 +700,24 @@ MediaEngineWebRTCVideoSource::Shutdown()
mInitDone = false;
}
void MediaEngineWebRTCVideoSource::Refresh(int aIndex) {
mCaptureIndex = aIndex;
#ifdef MOZ_B2G_CAMERA
// Caller looked up this source by uniqueId; since deviceName == uniqueId nothing else changes
#else
// Caller looked up this source by uniqueId, so it shouldn't change
const uint32_t KMaxDeviceNameLength = 128;
char deviceName[KMaxDeviceNameLength];
if (mViECapture->GetCaptureDevice(mCaptureIndex,
deviceName, KMaxDeviceNameLength,
nullptr, 0)) {
return;
}
CopyUTF8toUTF16(deviceName, mDeviceName);
#endif
}
#ifdef MOZ_B2G_CAMERA
// All these functions must be run on MainThread!