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
Родитель c5b55f7c49
Коммит b659301233
3 изменённых файлов: 23 добавлений и 1 удалений

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

@ -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);

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

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

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

@ -700,6 +700,25 @@ MediaEngineWebRTCVideoSource::Shutdown()
mInitDone = false;
}
void MediaEngineWebRTCVideoSource::Refresh(int aIndex) {
// NOTE: mCaptureIndex might have changed when allocated!
// Use aIndex to update information, but don't change mCaptureIndex!!
#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(aIndex,
deviceName, KMaxDeviceNameLength,
nullptr, 0)) {
return;
}
CopyUTF8toUTF16(deviceName, mDeviceName);
#endif
}
#ifdef MOZ_B2G_CAMERA
// All these functions must be run on MainThread!