Bug 832745 - Adding a principal for a stream when creating. r=roc

This commit is contained in:
Alexandre Lissy 2013-01-30 11:03:17 +01:00
Родитель 4b0cca96b6
Коммит 3431ca7c5f
3 изменённых файлов: 11 добавлений и 3 удалений

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

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