зеркало из https://github.com/mozilla/gecko-dev.git
bug 1161276 - part 1 add bits-per-second interface to MediaRecorder r=roc,smaug
This commit is contained in:
Родитель
e917102de7
Коммит
5e7ac88cc7
|
@ -965,7 +965,7 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
|||
}
|
||||
|
||||
nsRefPtr<MediaRecorder> object = new MediaRecorder(aStream, ownerWindow);
|
||||
object->SetMimeType(aInitDict.mMimeType);
|
||||
object->SetOptions(aInitDict);
|
||||
return object.forget();
|
||||
}
|
||||
|
||||
|
@ -1001,10 +1001,22 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
|||
nsRefPtr<MediaRecorder> object = new MediaRecorder(aSrcAudioNode,
|
||||
aSrcOutput,
|
||||
ownerWindow);
|
||||
object->SetMimeType(aInitDict.mMimeType);
|
||||
object->SetOptions(aInitDict);
|
||||
return object.forget();
|
||||
}
|
||||
|
||||
void
|
||||
MediaRecorder::SetOptions(const MediaRecorderOptions& aInitDict)
|
||||
{
|
||||
SetMimeType(aInitDict.mMimeType);
|
||||
mAudioBitsPerSecond = aInitDict.mAudioBitsPerSecond.WasPassed() ?
|
||||
aInitDict.mAudioBitsPerSecond.Value() : 0;
|
||||
mVideoBitsPerSecond = aInitDict.mVideoBitsPerSecond.WasPassed() ?
|
||||
aInitDict.mVideoBitsPerSecond.Value() : 0;
|
||||
mBitsPerSecond = aInitDict.mBitsPerSecond.WasPassed() ?
|
||||
aInitDict.mBitsPerSecond.Value() : 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob)
|
||||
{
|
||||
|
|
|
@ -118,6 +118,7 @@ protected:
|
|||
bool CheckPrincipal();
|
||||
// Set encoded MIME type.
|
||||
void SetMimeType(const nsString &aMimeType);
|
||||
void SetOptions(const MediaRecorderOptions& aInitDict);
|
||||
|
||||
MediaRecorder(const MediaRecorder& x) = delete; // prevent bad usage
|
||||
// Remove session pointer.
|
||||
|
@ -144,6 +145,9 @@ protected:
|
|||
// It specifies the container format as well as the audio and video capture formats.
|
||||
nsString mMimeType;
|
||||
|
||||
uint32_t mAudioBitsPerSecond;
|
||||
uint32_t mVideoBitsPerSecond;
|
||||
uint32_t mBitsPerSecond;
|
||||
private:
|
||||
// Register MediaRecorder into Document to listen the activity changes.
|
||||
void RegisterActivityObserver();
|
||||
|
|
|
@ -51,4 +51,7 @@ interface MediaRecorder : EventTarget {
|
|||
|
||||
dictionary MediaRecorderOptions {
|
||||
DOMString mimeType = ""; // Default encoding mimeType.
|
||||
unsigned long audioBitsPerSecond;
|
||||
unsigned long videoBitsPerSecond;
|
||||
unsigned long bitsPerSecond;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче