зеркало из https://github.com/mozilla/gecko-dev.git
Bug 832745 - Adding a principal for a stream when creating. r=roc
This commit is contained in:
Родитель
4b0cca96b6
Коммит
3431ca7c5f
|
@ -420,7 +420,7 @@ GetPreviewStreamResult::Run()
|
|||
|
||||
nsCOMPtr<nsICameraPreviewStreamCallback> onSuccess = mOnSuccessCb.get();
|
||||
if (onSuccess && nsDOMCameraManager::IsWindowStillActive(mWindowId)) {
|
||||
nsCOMPtr<nsIDOMMediaStream> stream = new DOMCameraPreview(mCameraControl, mWidth, mHeight, mFramesPerSecond);
|
||||
nsCOMPtr<nsIDOMMediaStream> stream = new DOMCameraPreview(mCameraControl, mWidth, mHeight, mWindowId, mFramesPerSecond);
|
||||
onSuccess->HandleEvent(stream);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "VideoUtils.h"
|
||||
#include "DOMCameraPreview.h"
|
||||
#include "CameraCommon.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
@ -138,7 +140,7 @@ protected:
|
|||
DOMCameraPreview* mDOMPreview;
|
||||
};
|
||||
|
||||
DOMCameraPreview::DOMCameraPreview(ICameraControl* aCameraControl, uint32_t aWidth, uint32_t aHeight, uint32_t aFrameRate)
|
||||
DOMCameraPreview::DOMCameraPreview(ICameraControl* aCameraControl, uint32_t aWidth, uint32_t aHeight, uint64_t aWindowId, uint32_t aFrameRate)
|
||||
: nsDOMMediaStream()
|
||||
, mState(STOPPED)
|
||||
, mWidth(aWidth)
|
||||
|
@ -159,6 +161,12 @@ DOMCameraPreview::DOMCameraPreview(ICameraControl* aCameraControl, uint32_t aWid
|
|||
|
||||
mInput->AddTrack(TRACK_VIDEO, mFramesPerSecond, 0, new VideoSegment());
|
||||
mInput->AdvanceKnownTracksTime(MEDIA_TIME_MAX);
|
||||
|
||||
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
|
||||
(nsGlobalWindow::GetInnerWindowWithId(aWindowId));
|
||||
if (window && window->GetExtantDoc()) {
|
||||
this->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
|
||||
}
|
||||
}
|
||||
|
||||
DOMCameraPreview::~DOMCameraPreview()
|
||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
|||
enum { TRACK_VIDEO = 1 };
|
||||
|
||||
public:
|
||||
DOMCameraPreview(ICameraControl* aCameraControl, uint32_t aWidth, uint32_t aHeight, uint32_t aFramesPerSecond = 30);
|
||||
DOMCameraPreview(ICameraControl* aCameraControl, uint32_t aWidth, uint32_t aHeight, uint64_t aWindowId, uint32_t aFramesPerSecond = 30);
|
||||
bool ReceiveFrame(void* aBuffer, ImageFormat aFormat, mozilla::FrameBuilder aBuilder);
|
||||
bool HaveEnoughBuffered();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче