зеркало из https://github.com/mozilla/gecko-dev.git
Bug 879478 - fix regressions when starting camera (crash and de-virtualized functions -- see also bug 880780), r=roc
This commit is contained in:
Родитель
cef1633ecb
Коммит
572d8a584b
|
@ -1494,6 +1494,13 @@ MediaStream::SetGraphImpl(MediaStreamGraphImpl* aGraph)
|
|||
mGraph = aGraph;
|
||||
}
|
||||
|
||||
void
|
||||
MediaStream::SetGraphImpl(MediaStreamGraph* aGraph)
|
||||
{
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(aGraph);
|
||||
SetGraphImpl(graph);
|
||||
}
|
||||
|
||||
StreamTime
|
||||
MediaStream::GraphTimeToStreamTime(GraphTime aTime)
|
||||
{
|
||||
|
|
|
@ -294,6 +294,7 @@ public:
|
|||
* Sets the graph that owns this stream. Should only be called once.
|
||||
*/
|
||||
void SetGraphImpl(MediaStreamGraphImpl* aGraph);
|
||||
void SetGraphImpl(MediaStreamGraph* aGraph);
|
||||
|
||||
// Control API.
|
||||
// Since a stream can be played multiple ways, we need to combine independent
|
||||
|
@ -302,20 +303,20 @@ public:
|
|||
// a single audio output stream is used; the volumes are combined.
|
||||
// Currently only the first enabled audio track is played.
|
||||
// XXX change this so all enabled audio tracks are mixed and played.
|
||||
void AddAudioOutput(void* aKey);
|
||||
void SetAudioOutputVolume(void* aKey, float aVolume);
|
||||
void RemoveAudioOutput(void* aKey);
|
||||
virtual void AddAudioOutput(void* aKey);
|
||||
virtual void SetAudioOutputVolume(void* aKey, float aVolume);
|
||||
virtual void RemoveAudioOutput(void* aKey);
|
||||
// Since a stream can be played multiple ways, we need to be able to
|
||||
// play to multiple VideoFrameContainers.
|
||||
// Only the first enabled video track is played.
|
||||
void AddVideoOutput(VideoFrameContainer* aContainer);
|
||||
void RemoveVideoOutput(VideoFrameContainer* aContainer);
|
||||
virtual void AddVideoOutput(VideoFrameContainer* aContainer);
|
||||
virtual void RemoveVideoOutput(VideoFrameContainer* aContainer);
|
||||
// Explicitly block. Useful for example if a media element is pausing
|
||||
// and we need to stop its stream emitting its buffered data.
|
||||
void ChangeExplicitBlockerCount(int32_t aDelta);
|
||||
virtual void ChangeExplicitBlockerCount(int32_t aDelta);
|
||||
// Events will be dispatched by calling methods of aListener.
|
||||
void AddListener(MediaStreamListener* aListener);
|
||||
void RemoveListener(MediaStreamListener* aListener);
|
||||
virtual void AddListener(MediaStreamListener* aListener);
|
||||
virtual void RemoveListener(MediaStreamListener* aListener);
|
||||
// A disabled track has video replaced by black, and audio replaced by
|
||||
// silence.
|
||||
void SetTrackEnabled(TrackID aTrackID, bool aEnabled);
|
||||
|
|
|
@ -10,6 +10,15 @@ using namespace mozilla::dom;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
CameraPreviewMediaStream::CameraPreviewMediaStream(DOMMediaStream* aWrapper)
|
||||
: MediaStream(aWrapper)
|
||||
, mMutex("mozilla::camera::CameraPreviewMediaStream")
|
||||
, mFrameCallback(nullptr)
|
||||
{
|
||||
SetGraphImpl(MediaStreamGraph::GetInstance());
|
||||
mIsConsumed = false;
|
||||
}
|
||||
|
||||
void
|
||||
CameraPreviewMediaStream::AddAudioOutput(void* aKey)
|
||||
{
|
||||
|
|
|
@ -23,26 +23,21 @@ public:
|
|||
* A camera preview requests no delay and no buffering stream.
|
||||
* But the SourceMediaStream do not support it.
|
||||
*/
|
||||
class CameraPreviewMediaStream : public MediaStream {
|
||||
class CameraPreviewMediaStream : public MediaStream
|
||||
{
|
||||
typedef mozilla::layers::Image Image;
|
||||
|
||||
public:
|
||||
CameraPreviewMediaStream(DOMMediaStream* aWrapper) :
|
||||
MediaStream(aWrapper),
|
||||
mMutex("mozilla::camera::CameraPreviewMediaStream"),
|
||||
mFrameCallback(nullptr)
|
||||
{
|
||||
mIsConsumed = false;
|
||||
}
|
||||
CameraPreviewMediaStream(DOMMediaStream* aWrapper);
|
||||
|
||||
virtual void AddAudioOutput(void* aKey);
|
||||
virtual void SetAudioOutputVolume(void* aKey, float aVolume);
|
||||
virtual void RemoveAudioOutput(void* aKey);
|
||||
virtual void AddVideoOutput(VideoFrameContainer* aContainer);
|
||||
virtual void RemoveVideoOutput(VideoFrameContainer* aContainer);
|
||||
virtual void ChangeExplicitBlockerCount(int32_t aDelta);
|
||||
virtual void AddListener(MediaStreamListener* aListener);
|
||||
virtual void RemoveListener(MediaStreamListener* aListener);
|
||||
virtual void AddAudioOutput(void* aKey) MOZ_OVERRIDE;
|
||||
virtual void SetAudioOutputVolume(void* aKey, float aVolume) MOZ_OVERRIDE;
|
||||
virtual void RemoveAudioOutput(void* aKey) MOZ_OVERRIDE;
|
||||
virtual void AddVideoOutput(VideoFrameContainer* aContainer) MOZ_OVERRIDE;
|
||||
virtual void RemoveVideoOutput(VideoFrameContainer* aContainer) MOZ_OVERRIDE;
|
||||
virtual void ChangeExplicitBlockerCount(int32_t aDelta) MOZ_OVERRIDE;
|
||||
virtual void AddListener(MediaStreamListener* aListener) MOZ_OVERRIDE;
|
||||
virtual void RemoveListener(MediaStreamListener* aListener) MOZ_OVERRIDE;
|
||||
virtual void Destroy();
|
||||
|
||||
// Call these on any thread.
|
||||
|
@ -60,7 +55,6 @@ protected:
|
|||
CameraPreviewFrameCallback* mFrameCallback;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // DOM_CAMERA_CAMERAPREVIEWMEDIASTREAM_H
|
||||
|
|
Загрузка…
Ссылка в новой задаче