本文整理汇总了C++中MediaStreamTrackVector::append方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaStreamTrackVector::append方法的具体用法?C++ MediaStreamTrackVector::append怎么用?C++ MediaStreamTrackVector::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaStreamTrackVector
的用法示例。
在下文中一共展示了MediaStreamTrackVector::append方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: captureStream
MediaStream* HTMLCanvasElementCapture::captureStream(HTMLCanvasElement& element, bool givenFrameRate, double frameRate, ExceptionState& exceptionState)
{
if (!element.originClean()) {
exceptionState.throwSecurityError("Canvas is not origin-clean.");
return nullptr;
}
WebMediaStreamTrack track;
WebSize size(element.width(), element.height());
OwnPtr<WebCanvasCaptureHandler> handler;
if (givenFrameRate)
handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track));
else
handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track));
ASSERT(handler);
if (!handler) {
exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture handler can be created.");
return nullptr;
}
MediaStreamTrackVector tracks;
if (givenFrameRate)
tracks.append(CanvasCaptureMediaStreamTrack::create(track, &element, handler.release(), frameRate));
else
tracks.append(CanvasCaptureMediaStreamTrack::create(track, &element, handler.release()));
// We want to capture one frame in the beginning.
element.notifyListenersCanvasChanged();
return MediaStream::create(element.executionContext(), tracks);
}
示例2: clone
MediaStream* MediaStream::clone(ExecutionContext* context)
{
MediaStreamTrackVector tracks;
for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter)
tracks.append((*iter)->clone(context));
for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter)
tracks.append((*iter)->clone(context));
return MediaStream::create(context, tracks);
}
示例3: getTracks
MediaStreamTrackVector MediaStream::getTracks()
{
MediaStreamTrackVector tracks;
for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter)
tracks.append(iter->get());
for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter)
tracks.append(iter->get());
return tracks;
}
示例4: trackVectorForType
MediaStreamTrackVector MediaStream::trackVectorForType(RealtimeMediaSource::Type filterType) const
{
MediaStreamTrackVector tracks;
for (auto& track : m_trackSet.values()) {
if (track->source().type() == filterType)
tracks.append(track);
}
return tracks;
}
示例5: create
RefPtr<MediaStream> MediaStream::clone()
{
MediaStreamTrackVector clonedTracks;
clonedTracks.reserveCapacity(m_trackSet.size());
for (auto& track : m_trackSet.values())
clonedTracks.append(track->clone());
return MediaStream::create(*scriptExecutionContext(), clonedTracks);
}
示例6: captureStream
MediaStream* HTMLCanvasElementCapture::captureStream(
HTMLCanvasElement& element,
bool givenFrameRate,
double frameRate,
ExceptionState& exceptionState) {
if (!element.originClean()) {
exceptionState.throwSecurityError("Canvas is not origin-clean.");
return nullptr;
}
WebMediaStreamTrack track;
const WebSize size(element.width(), element.height());
std::unique_ptr<WebCanvasCaptureHandler> handler;
if (givenFrameRate)
handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(
size, frameRate, &track));
else
handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(
size, kDefaultFrameRate, &track));
if (!handler) {
exceptionState.throwDOMException(
NotSupportedError, "No CanvasCapture handler can be created.");
return nullptr;
}
CanvasCaptureMediaStreamTrack* canvasTrack;
if (givenFrameRate)
canvasTrack = CanvasCaptureMediaStreamTrack::create(
track, &element, std::move(handler), frameRate);
else
canvasTrack = CanvasCaptureMediaStreamTrack::create(track, &element,
std::move(handler));
// We want to capture a frame in the beginning.
canvasTrack->requestFrame();
MediaStreamTrackVector tracks;
tracks.append(canvasTrack);
return MediaStream::create(element.getExecutionContext(), tracks);
}