зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1194640 - add NSPR logging of camera capabilities, r=jesup
--HG-- extra : transplant_source : %DD%14b%BA2%1D%B9%83%06%1B%94%E3%0C%EE%92%B6%BD%81%E9%08
This commit is contained in:
Родитель
c64c66da29
Коммит
b490b98cfc
|
@ -162,6 +162,49 @@ MediaEngineCameraVideoSource::LogConstraints(
|
|||
c.mFrameRate.mIdeal.WasPassed()? c.mFrameRate.mIdeal.Value() : 0));
|
||||
}
|
||||
|
||||
void
|
||||
MediaEngineCameraVideoSource::LogCapability(const char* aHeader,
|
||||
const webrtc::CaptureCapability &aCapability, uint32_t aDistance)
|
||||
{
|
||||
// RawVideoType and VideoCodecType media/webrtc/trunk/webrtc/common_types.h
|
||||
static const char* const types[] = {
|
||||
"I420",
|
||||
"YV12",
|
||||
"YUY2",
|
||||
"UYVY",
|
||||
"IYUV",
|
||||
"ARGB",
|
||||
"RGB24",
|
||||
"RGB565",
|
||||
"ARGB4444",
|
||||
"ARGB1555",
|
||||
"MJPEG",
|
||||
"NV12",
|
||||
"NV21",
|
||||
"BGRA",
|
||||
"Unknown type"
|
||||
};
|
||||
|
||||
static const char* const codec[] = {
|
||||
"VP8",
|
||||
"VP9",
|
||||
"H264",
|
||||
"I420",
|
||||
"RED",
|
||||
"ULPFEC",
|
||||
"Generic codec",
|
||||
"Unknown codec"
|
||||
};
|
||||
|
||||
LOG(("%s: %4u x %4u x %2u maxFps, %s, %s. Distance = %lu",
|
||||
aHeader, aCapability.width, aCapability.height, aCapability.maxFPS,
|
||||
types[std::min(std::max(uint32_t(0), uint32_t(aCapability.rawType)),
|
||||
uint32_t(sizeof(types) / sizeof(*types) - 1))],
|
||||
codec[std::min(std::max(uint32_t(0), uint32_t(aCapability.codecType)),
|
||||
uint32_t(sizeof(codec) / sizeof(*codec) - 1))],
|
||||
aDistance));
|
||||
}
|
||||
|
||||
bool
|
||||
MediaEngineCameraVideoSource::ChooseCapability(
|
||||
const MediaTrackConstraints &aConstraints,
|
||||
|
@ -195,6 +238,7 @@ MediaEngineCameraVideoSource::ChooseCapability(
|
|||
webrtc::CaptureCapability cap;
|
||||
GetCapability(candidate.mIndex, cap);
|
||||
candidate.mDistance = GetFitnessDistance(cap, aConstraints, false, aDeviceId);
|
||||
LogCapability("Capability", cap, candidate.mDistance);
|
||||
if (candidate.mDistance == UINT32_MAX) {
|
||||
candidateSet.RemoveElementAt(i);
|
||||
} else {
|
||||
|
@ -234,6 +278,7 @@ MediaEngineCameraVideoSource::ChooseCapability(
|
|||
|
||||
// Any remaining multiples all have the same distance. A common case of this
|
||||
// occurs when no ideal is specified. Lean toward defaults.
|
||||
uint32_t sameDistance = candidateSet[0].mDistance;
|
||||
{
|
||||
MediaTrackConstraintSet prefs;
|
||||
prefs.mWidth.SetAsLong() = aPrefs.GetWidth();
|
||||
|
@ -268,9 +313,7 @@ MediaEngineCameraVideoSource::ChooseCapability(
|
|||
GetCapability(candidateSet[0].mIndex, mCapability);
|
||||
}
|
||||
|
||||
LOG(("chose cap %dx%d @%dfps codec %d raw %d",
|
||||
mCapability.width, mCapability.height, mCapability.maxFPS,
|
||||
mCapability.codecType, mCapability.rawType));
|
||||
LogCapability("Chosen capability", mCapability, sameDistance);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,9 @@ protected:
|
|||
static void TrimLessFitCandidates(CapabilitySet& set);
|
||||
static void LogConstraints(const dom::MediaTrackConstraintSet& aConstraints,
|
||||
bool aAdvanced);
|
||||
static void LogCapability(const char* aHeader,
|
||||
const webrtc::CaptureCapability &aCapability,
|
||||
uint32_t aDistance);
|
||||
virtual size_t NumCapabilities();
|
||||
virtual void GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut);
|
||||
bool ChooseCapability(const dom::MediaTrackConstraints &aConstraints,
|
||||
|
|
Загрузка…
Ссылка в новой задаче