mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
2e02aab9a7
- Bug 1198458: Webrtc updated to branch 43; pull made 2015-09-29 09:00AM PDT rs=jesup (c45a789c99) - Bug 1159489: WebRTC bitrate limits for video depend on input resolution and framerate r=pkerr (e3691a247c) - Bug 1132318: merge SelectSendFrameRate with SelectSendResolution r=bwc (bcc232994c) - Bug 1182289: Clean up dispatches in WebrtcGmpVideoEncoder/Decoder. r=jesup, a=abillings (b5e2030b07) - Bug 1167306: Fix preprocessor goof that disabled the load manager and some preference handling. r=jesup (0cc0dee688) - Bug 1198458: Rollup of changes previously applied to media/webrtc/trunk/webrtc and fixes to those rs=jesup r=froyd,jib,bwc,jesup,gcp,sotaro,pkerr,pehrsons (fe384d5e63) - Bug 1198458 Unbreak build on BSDs by fixing non-POSIX thread includes/usage. r=jesup (4ad8e88c17) - Bug 1198458: Fix typo in merges in OMX rs=bustage,kwierso on a CLOSED TREE (211b3b1a3f) - Bug 1226146: fix sndio audio_device backend after webrtc 43 landing in bug 1198458 r=jesup NPOTB (2b10ba3e86) - Bug 1231106 - Make BSDs fall-through to ASSERT as well. r=jesup (775d4fedae) - Bug 1231109 - Drop FreeBSD checks for unsupported versions. r=jld r=jesup (3cd55166fd) - Bug 1161079: Fix VideoCodecStats to allow for collecting encoder and decoder stats r=jib (1f98af8939) - add limits to fix gcc12 compile (d78098980f) - Bug 1193495 - Part 1: Test case. r=mt (add2ded009) - Bug 1193495 - Part 2: Maintain clones of supported codecs for each level, and do necessary checking to prevent payload-type clashes. r=mt (d45a24dba7) - Bug 1191301 - Re-enable the use of media.navigator.video.use_tmmbr pref. r=bwc (d2723821d4) - Bug 1094447 - Use UDP/TLS/RTP/SAVPF for audio/video m-lines. r=drno (e8e1dafd0a) - Bug 1173599 - a=imageattr support. r=mt (612fc343d7) - Bug 1173601 - Add a=simulcast support. r=mt (7c5303bacb) - Bug 1203246 - Factor track negotiation stuff out of JsepSessionImpl, and other simplification. r=mt (b71c809b78) - Bug 1212907 - a=rid support. r=mt (7479ab6984) - Bug 1212908 - Update a=simulcast to match new grammar in 03 draft. r=mt (e205d3b0dd) - Bug 1192390 - Part 1: Lay architectural groundwork for simulcast negotiation. r=mt r=jesup (e75dda3139) - Bug 1223160 - added SDP parser file reader. r=bwc (6752195791) - Bug 1192390 - Part 2: Simulcast and RID negotiation. r=mt (51b151ef52) - fix some warnings stuff (fed8f513a8) - Bug 1161317: Fix bug where sendonly video RTCP would be treated as outgoing RTP r=jesup (e24371fbe0) - Bug 1226347: Import cherry-pick of AEC changes from 43->48 (delay-agnostic AEC). r=pkerr (d3a074f4d8) - Bug 1226347 - Part 2: Allow control of AEC via prefs. r=rjesup (58f142005b) - Bug 1228788 - Force QT device release to happen on the main thread. r=jesup (885e9d1236) - Bug 1162218 - Make worker idle thread timeouts more strict, r=baku. (a7d2106987) - No bug. Remove a stray debugging printf of mine. r=me. (77b84cda62) - minor (22564a666e) - Bug 1224237 - Remove the !baseURL check from ServiceWorkerContainer::Register;r=bkelly (8b13c4dc49) - Bug 1196157 - Marks left by performance marks should print the domain of the application and not the complete URL. r=baku (d133708d8d) - Bug 1211970 - "Muted errors in workers are not correctly reported to the console". r=bz (42c15275f4) - Bug 1208559 - Tests. r=bholley (e16a30caa5) - Bug 1045891 - Tests for child-src r=ckerschb (90aa832cd0) - Bug 1223647: CSP erroneously inherited into dedicated workers. r=ckerschb (6fd8d9bfc9) - Bug 1218433 - Use AsyncOpen2 in dom/workers/ScriptLoader.cpp - part 1, r=sicking (a7e9187e52) - Bug 1218433 - Use AsyncOpen2 in dom/workers/ScriptLoader.cpp - part 3 - WPT, r=sicking, r=Ms2ger (e5e3c69f6a) - Bug 1218433 - Use AsyncOpen2 in dom/workers/ScriptLoader.cpp - part 2 - WPT, r=sicking, r=Ms2ger (1dd2d871ec) - Bug 1211967 - Fix how we report errors when loading a worker from a data url, r=bz (8517368daa) - nsRefPtr - RefPtr (34bb404530) - Bug 1231055 - Fix tags usage in PluginProvider. r=dtownsend (870b0e71eb) - bug 1228792 - remove use of array comprehensions r=mossop (3e31f18e83) - bug 1228792 - use standard version of catch r=mossop (f306557ca2) - Bug 1228009. Geolocation code needs to handle failures on its ErrorResults. r=smaug (8778a9e264) - Bug 1228707. Add a away to call Web IDL callbacks while ignoring any errors from them, and use it in a few places. r=smaug (a414e0d711) - Bug 1201692. Add a fast path to ExplicitChildIterator::Seek for the common case of seeking an actual DOM child of the parent node. r=wchen (01234ad43a) - Bug 1202186 - use nsISensitiveInfoHidden for console methods, r=baku (888b4506ad) - Bug 1223774 - Console API should check if the outer window exists, r=smaug (e0d7f408dc) - Bug 1200551 - Handle multiple %c formatters without a string between them by using only the last one for styling;r=baku,r=past (463550117a) - Bug 1213719 - Back out bug 1170314 for duplicate functionality. r=smaug (ae74e0ad52) - Bug 1154076 followup: Mark ConsoleRunnable::Run() as override. rs=ehsan (337181faab) - Bug 1127703 - "Support iteration on FormData" r=bz (4ddd461e99) - Bug 1230509 - BlobImplFile should return false in IsDateUnknown and IsSizeUnknown, r=bz (1079bfe2ab) - Bug 1198095 - FileReader should dispatch an error if the blob changes size in the meantime the read is executed, r=bz (263993a172) - Bug 1231094 - patch 1 - nsDOMFileReader to mozilla::dom::FileReader, r=sicking (aa8c3ff373) - Bug 1231094 - patch 2 - Get rid of FileIOObject, r=sicking (44af1e17dd) - Bug 1231100 - Get rid of nsIDOMFileReader - patch 1, r=sicking (c909d9d793) - Bug 1231100 - Get rid of nsIDOMFileReader - patch 2, r=sicking (4d3da1c566) - Bug 1161183: Don't show the add-on version in the list view. r=dao (002d8f6fb1) - Bug 1229519: Fix toolkit/modules to pass eslint checks. r=mak (8bbd9c8fe0)
457 lines
13 KiB
C++
457 lines
13 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "MediaEngineRemoteVideoSource.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
#include "VideoUtils.h"
|
|
#include "nsIPrefService.h"
|
|
#include "MediaTrackConstraints.h"
|
|
#include "CamerasChild.h"
|
|
|
|
extern mozilla::LogModule* GetMediaManagerLog();
|
|
#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg)
|
|
#define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg)
|
|
|
|
namespace mozilla {
|
|
|
|
using dom::ConstrainLongRange;
|
|
|
|
NS_IMPL_ISUPPORTS0(MediaEngineRemoteVideoSource)
|
|
|
|
MediaEngineRemoteVideoSource::MediaEngineRemoteVideoSource(
|
|
int aIndex, mozilla::camera::CaptureEngine aCapEngine,
|
|
dom::MediaSourceEnum aMediaSource, const char* aMonitorName)
|
|
: MediaEngineCameraVideoSource(aIndex, aMonitorName),
|
|
mMediaSource(aMediaSource),
|
|
mCapEngine(aCapEngine)
|
|
{
|
|
MOZ_ASSERT(aMediaSource != dom::MediaSourceEnum::Other);
|
|
Init();
|
|
}
|
|
|
|
void
|
|
MediaEngineRemoteVideoSource::Init()
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
char deviceName[kMaxDeviceNameLength];
|
|
char uniqueId[kMaxUniqueIdLength];
|
|
if (mozilla::camera::GetCaptureDevice(mCapEngine,
|
|
mCaptureIndex,
|
|
deviceName, kMaxDeviceNameLength,
|
|
uniqueId, kMaxUniqueIdLength)) {
|
|
LOG(("Error initializing RemoteVideoSource (GetCaptureDevice)"));
|
|
return;
|
|
}
|
|
|
|
SetName(NS_ConvertUTF8toUTF16(deviceName));
|
|
SetUUID(uniqueId);
|
|
|
|
mInitDone = true;
|
|
|
|
return;
|
|
}
|
|
|
|
void
|
|
MediaEngineRemoteVideoSource::Shutdown()
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
if (!mInitDone) {
|
|
return;
|
|
}
|
|
if (mState == kStarted) {
|
|
SourceMediaStream *source;
|
|
bool empty;
|
|
|
|
while (1) {
|
|
{
|
|
MonitorAutoLock lock(mMonitor);
|
|
empty = mSources.IsEmpty();
|
|
if (empty) {
|
|
break;
|
|
}
|
|
source = mSources[0];
|
|
}
|
|
Stop(source, kVideoTrack); // XXX change to support multiple tracks
|
|
}
|
|
MOZ_ASSERT(mState == kStopped);
|
|
}
|
|
|
|
if (mState == kAllocated || mState == kStopped) {
|
|
Deallocate();
|
|
}
|
|
|
|
mozilla::camera::Shutdown();
|
|
|
|
mState = kReleased;
|
|
mInitDone = false;
|
|
return;
|
|
}
|
|
|
|
nsresult
|
|
MediaEngineRemoteVideoSource::Allocate(const dom::MediaTrackConstraints& aConstraints,
|
|
const MediaEnginePrefs& aPrefs,
|
|
const nsString& aDeviceId)
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
|
|
if (!mInitDone) {
|
|
LOG(("Init not done"));
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
if (mState == kReleased) {
|
|
// Note: if shared, we don't allow a later opener to affect the resolution.
|
|
// (This may change depending on spec changes for Constraints/settings)
|
|
|
|
if (!ChooseCapability(aConstraints, aPrefs, aDeviceId)) {
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
if (mozilla::camera::AllocateCaptureDevice(mCapEngine,
|
|
GetUUID().get(),
|
|
kMaxUniqueIdLength, mCaptureIndex)) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
mState = kAllocated;
|
|
LOG(("Video device %d allocated", mCaptureIndex));
|
|
} else if (MOZ_LOG_TEST(GetMediaManagerLog(), mozilla::LogLevel::Debug)) {
|
|
MonitorAutoLock lock(mMonitor);
|
|
if (mSources.IsEmpty()) {
|
|
LOG(("Video device %d reallocated", mCaptureIndex));
|
|
} else {
|
|
LOG(("Video device %d allocated shared", mCaptureIndex));
|
|
}
|
|
}
|
|
|
|
++mNrAllocations;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
MediaEngineRemoteVideoSource::Deallocate()
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
|
|
--mNrAllocations;
|
|
MOZ_ASSERT(mNrAllocations >= 0, "Double-deallocations are prohibited");
|
|
|
|
if (mNrAllocations == 0) {
|
|
if (mState != kStopped && mState != kAllocated) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
mozilla::camera::ReleaseCaptureDevice(mCapEngine, mCaptureIndex);
|
|
mState = kReleased;
|
|
LOG(("Video device %d deallocated", mCaptureIndex));
|
|
} else {
|
|
LOG(("Video device %d deallocated but still in use", mCaptureIndex));
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
MediaEngineRemoteVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
if (!mInitDone || !aStream) {
|
|
LOG(("No stream or init not done"));
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
{
|
|
MonitorAutoLock lock(mMonitor);
|
|
mSources.AppendElement(aStream);
|
|
}
|
|
|
|
aStream->AddTrack(aID, 0, new VideoSegment(), SourceMediaStream::ADDTRACK_QUEUED);
|
|
|
|
if (mState == kStarted) {
|
|
return NS_OK;
|
|
}
|
|
mImageContainer = layers::LayerManager::CreateImageContainer();
|
|
|
|
mState = kStarted;
|
|
mTrackID = aID;
|
|
|
|
if (mozilla::camera::StartCapture(mCapEngine,
|
|
mCaptureIndex, mCapability, this)) {
|
|
LOG(("StartCapture failed"));
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
MediaEngineRemoteVideoSource::Stop(mozilla::SourceMediaStream* aSource,
|
|
mozilla::TrackID aID)
|
|
{
|
|
LOG((__PRETTY_FUNCTION__));
|
|
{
|
|
MonitorAutoLock lock(mMonitor);
|
|
|
|
if (!mSources.RemoveElement(aSource)) {
|
|
// Already stopped - this is allowed
|
|
return NS_OK;
|
|
}
|
|
|
|
aSource->EndTrack(aID);
|
|
|
|
if (!mSources.IsEmpty()) {
|
|
return NS_OK;
|
|
}
|
|
if (mState != kStarted) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
mState = kStopped;
|
|
// Drop any cached image so we don't start with a stale image on next
|
|
// usage
|
|
mImage = nullptr;
|
|
}
|
|
|
|
mozilla::camera::StopCapture(mCapEngine, mCaptureIndex);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
MediaEngineRemoteVideoSource::Restart(const dom::MediaTrackConstraints& aConstraints,
|
|
const MediaEnginePrefs& aPrefs,
|
|
const nsString& aDeviceId)
|
|
{
|
|
if (!mInitDone) {
|
|
LOG(("Init not done"));
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
if (!ChooseCapability(aConstraints, aPrefs, aDeviceId)) {
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
}
|
|
if (mState != kStarted) {
|
|
return NS_OK;
|
|
}
|
|
|
|
mozilla::camera::StopCapture(mCapEngine, mCaptureIndex);
|
|
if (mozilla::camera::StartCapture(mCapEngine,
|
|
mCaptureIndex, mCapability, this)) {
|
|
LOG(("StartCapture failed"));
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
MediaEngineRemoteVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
|
SourceMediaStream* aSource,
|
|
TrackID aID, StreamTime aDesiredTime)
|
|
{
|
|
VideoSegment segment;
|
|
|
|
MonitorAutoLock lock(mMonitor);
|
|
StreamTime delta = aDesiredTime - aSource->GetEndOfAppendedData(aID);
|
|
|
|
if (delta > 0) {
|
|
// nullptr images are allowed
|
|
AppendToTrack(aSource, mImage, aID, delta);
|
|
}
|
|
}
|
|
|
|
int
|
|
MediaEngineRemoteVideoSource::FrameSizeChange(unsigned int w, unsigned int h,
|
|
unsigned int streams)
|
|
{
|
|
mWidth = w;
|
|
mHeight = h;
|
|
LOG(("MediaEngineRemoteVideoSource Video FrameSizeChange: %ux%u", w, h));
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
MediaEngineRemoteVideoSource::DeliverFrame(unsigned char* buffer,
|
|
size_t size,
|
|
uint32_t time_stamp,
|
|
int64_t ntp_time,
|
|
int64_t render_time,
|
|
void *handle)
|
|
{
|
|
// Check for proper state.
|
|
if (mState != kStarted) {
|
|
LOG(("DeliverFrame: video not started"));
|
|
return 0;
|
|
}
|
|
|
|
if ((size_t) (mWidth*mHeight + 2*(((mWidth+1)/2)*((mHeight+1)/2))) != size) {
|
|
MOZ_ASSERT(false, "Wrong size frame in DeliverFrame!");
|
|
return 0;
|
|
}
|
|
|
|
// Create a video frame and append it to the track.
|
|
RefPtr<layers::PlanarYCbCrImage> image = mImageContainer->CreatePlanarYCbCrImage();
|
|
|
|
uint8_t* frame = static_cast<uint8_t*> (buffer);
|
|
const uint8_t lumaBpp = 8;
|
|
const uint8_t chromaBpp = 4;
|
|
|
|
// Take lots of care to round up!
|
|
layers::PlanarYCbCrData data;
|
|
data.mYChannel = frame;
|
|
data.mYSize = IntSize(mWidth, mHeight);
|
|
data.mYStride = (mWidth * lumaBpp + 7)/ 8;
|
|
data.mCbCrStride = (mWidth * chromaBpp + 7) / 8;
|
|
data.mCbChannel = frame + mHeight * data.mYStride;
|
|
data.mCrChannel = data.mCbChannel + ((mHeight+1)/2) * data.mCbCrStride;
|
|
data.mCbCrSize = IntSize((mWidth+1)/ 2, (mHeight+1)/ 2);
|
|
data.mPicX = 0;
|
|
data.mPicY = 0;
|
|
data.mPicSize = IntSize(mWidth, mHeight);
|
|
data.mStereoMode = StereoMode::MONO;
|
|
|
|
if (!image->SetData(data)) {
|
|
MOZ_ASSERT(false);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
static uint32_t frame_num = 0;
|
|
LOGFRAME(("frame %d (%dx%d); timestamp %u, ntp_time %lu, render_time %lu", frame_num++,
|
|
mWidth, mHeight, time_stamp, ntp_time, render_time));
|
|
#endif
|
|
|
|
// we don't touch anything in 'this' until here (except for snapshot,
|
|
// which has it's own lock)
|
|
MonitorAutoLock lock(mMonitor);
|
|
|
|
// implicitly releases last image
|
|
mImage = image.forget();
|
|
|
|
// Push the frame into the MSG with a minimal duration. This will likely
|
|
// mean we'll still get NotifyPull calls which will then return the same
|
|
// frame again with a longer duration. However, this means we won't
|
|
// fail to get the frame in and drop frames.
|
|
|
|
// XXX The timestamp for the frame should be based on the Capture time,
|
|
// not the MSG time, and MSG should never, ever block on a (realtime)
|
|
// video frame (or even really for streaming - audio yes, video probably no).
|
|
// Note that MediaPipeline currently ignores the timestamps from MSG
|
|
uint32_t len = mSources.Length();
|
|
for (uint32_t i = 0; i < len; i++) {
|
|
if (mSources[i]) {
|
|
AppendToTrack(mSources[i], mImage, mTrackID, 1); // shortest possible duration
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
size_t
|
|
MediaEngineRemoteVideoSource::NumCapabilities()
|
|
{
|
|
int num = mozilla::camera::NumberOfCapabilities(mCapEngine, GetUUID().get());
|
|
if (num > 0) {
|
|
return num;
|
|
}
|
|
|
|
switch(mMediaSource) {
|
|
case dom::MediaSourceEnum::Camera:
|
|
#ifdef XP_MACOSX
|
|
// Mac doesn't support capabilities.
|
|
//
|
|
// Hardcode generic desktop capabilities modeled on OSX camera.
|
|
// Note: Values are empirically picked to be OSX friendly, as on OSX, values
|
|
// other than these cause the source to not produce.
|
|
|
|
if (mHardcodedCapabilities.IsEmpty()) {
|
|
for (int i = 0; i < 9; i++) {
|
|
webrtc::CaptureCapability c;
|
|
c.width = 1920 - i*128;
|
|
c.height = 1080 - i*72;
|
|
c.maxFPS = 30;
|
|
mHardcodedCapabilities.AppendElement(c);
|
|
}
|
|
for (int i = 0; i < 16; i++) {
|
|
webrtc::CaptureCapability c;
|
|
c.width = 640 - i*40;
|
|
c.height = 480 - i*30;
|
|
c.maxFPS = 30;
|
|
mHardcodedCapabilities.AppendElement(c);
|
|
}
|
|
}
|
|
break;
|
|
#endif
|
|
default:
|
|
webrtc::CaptureCapability c;
|
|
// The default for devices that don't return discrete capabilities: treat
|
|
// them as supporting all capabilities orthogonally. E.g. screensharing.
|
|
c.width = 0; // 0 = accept any value
|
|
c.height = 0;
|
|
c.maxFPS = 0;
|
|
mHardcodedCapabilities.AppendElement(c);
|
|
break;
|
|
}
|
|
|
|
return mHardcodedCapabilities.Length();
|
|
}
|
|
|
|
bool
|
|
MediaEngineRemoteVideoSource::ChooseCapability(const MediaTrackConstraints &aConstraints,
|
|
const MediaEnginePrefs &aPrefs,
|
|
const nsString& aDeviceId)
|
|
{
|
|
|
|
switch(mMediaSource) {
|
|
case dom::MediaSourceEnum::Screen:
|
|
case dom::MediaSourceEnum::Window:
|
|
case dom::MediaSourceEnum::Application: {
|
|
FlattenedConstraints c(aConstraints);
|
|
mCapability.width = ((c.mWidth.mIdeal.WasPassed() ?
|
|
c.mWidth.mIdeal.Value() : 0) & 0xffff) << 16 | (c.mWidth.mMax & 0xffff);
|
|
mCapability.height = ((c.mHeight.mIdeal.WasPassed() ?
|
|
c.mHeight.mIdeal.Value() : 0) & 0xffff) << 16 | (c.mHeight.mMax & 0xffff);
|
|
mCapability.maxFPS = c.mFrameRate.Clamp(c.mFrameRate.mIdeal.WasPassed() ?
|
|
c.mFrameRate.mIdeal.Value() : aPrefs.mFPS);
|
|
return true;
|
|
}
|
|
default:
|
|
return MediaEngineCameraVideoSource::ChooseCapability(aConstraints, aPrefs, aDeviceId);
|
|
}
|
|
|
|
}
|
|
|
|
void
|
|
MediaEngineRemoteVideoSource::GetCapability(size_t aIndex,
|
|
webrtc::CaptureCapability& aOut)
|
|
{
|
|
if (!mHardcodedCapabilities.IsEmpty()) {
|
|
MediaEngineCameraVideoSource::GetCapability(aIndex, aOut);
|
|
}
|
|
mozilla::camera::GetCaptureCapability(mCapEngine,
|
|
GetUUID().get(),
|
|
aIndex,
|
|
aOut);
|
|
}
|
|
|
|
void MediaEngineRemoteVideoSource::Refresh(int aIndex) {
|
|
// NOTE: mCaptureIndex might have changed when allocated!
|
|
// Use aIndex to update information, but don't change mCaptureIndex!!
|
|
// Caller looked up this source by uniqueId, so it shouldn't change
|
|
char deviceName[kMaxDeviceNameLength];
|
|
char uniqueId[kMaxUniqueIdLength];
|
|
|
|
if (mozilla::camera::GetCaptureDevice(mCapEngine,
|
|
aIndex,
|
|
deviceName, sizeof(deviceName),
|
|
uniqueId, sizeof(uniqueId))) {
|
|
return;
|
|
}
|
|
|
|
SetName(NS_ConvertUTF8toUTF16(deviceName));
|
|
#ifdef DEBUG
|
|
MOZ_ASSERT(GetUUID().Equals(uniqueId));
|
|
#endif
|
|
}
|
|
|
|
}
|