当前位置: 首页>>代码示例>>C++>>正文


C++ VideoTrack::trackId方法代码示例

本文整理汇总了C++中VideoTrack::trackId方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoTrack::trackId方法的具体用法?C++ VideoTrack::trackId怎么用?C++ VideoTrack::trackId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VideoTrack的用法示例。


在下文中一共展示了VideoTrack::trackId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

std::vector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(const std::vector<MediaTrackInfo>& newTracks)
{
    WTF_LOG(Media, "SourceBuffer::initializationSegmentReceived %p tracks=%zu", this, newTracks.size());
    ASSERT(m_source);
    ASSERT(m_source->mediaElement());
    ASSERT(m_updating);

    // TODO(servolk): Implement proper 'initialization segment received' algorithm according to MSE spec:
    // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received
    std::vector<WebMediaPlayer::TrackId> result;
    for (const auto& trackInfo : newTracks) {
        const auto& trackType = std::get<0>(trackInfo);
        const auto& id = std::get<1>(trackInfo);
        const auto& kind = std::get<2>(trackInfo);
        const auto& label = std::get<3>(trackInfo);
        const auto& language = std::get<4>(trackInfo);

        if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) {
            static WebMediaPlayer::TrackId nextTrackId = 0;
            result.push_back(++nextTrackId);
            continue;
        }

        const TrackBase* trackBase = nullptr;
        if (trackType == WebMediaPlayer::AudioTrack) {
            AudioTrack* audioTrack = nullptr;
            if (!m_firstInitializationSegmentReceived) {
                audioTrack = AudioTrack::create(id, kind, label, language, false);
                audioTracks().add(audioTrack);
                m_source->mediaElement()->audioTracks().add(audioTrack);
            } else {
                audioTrack = findExistingTrackById(audioTracks(), id);
                ASSERT(audioTrack);
            }
            trackBase = audioTrack;
            result.push_back(audioTrack->trackId());
        } else if (trackType == WebMediaPlayer::VideoTrack) {
            VideoTrack* videoTrack = nullptr;
            if (!m_firstInitializationSegmentReceived) {
                videoTrack = VideoTrack::create(id, kind, label, language, false);
                videoTracks().add(videoTrack);
                m_source->mediaElement()->videoTracks().add(videoTrack);
            } else {
                videoTrack = findExistingTrackById(videoTracks(), id);
                ASSERT(videoTrack);
            }
            trackBase = videoTrack;
            result.push_back(videoTrack->trackId());
        } else {
            NOTREACHED();
        }
        (void)trackBase;
#if !LOG_DISABLED
        const char* logActionStr = m_firstInitializationSegmentReceived ? "using existing" : "added";
        const char* logTrackTypeStr = (trackType == WebMediaPlayer::AudioTrack) ? "audio" : "video";
        WTF_LOG(Media, "Tracks (sb=%p): %s %sTrack %p trackId=%d id=%s label=%s lang=%s", this, logActionStr, logTrackTypeStr, trackBase, trackBase->trackId(), trackBase->id().utf8().data(), trackBase->label().utf8().data(), trackBase->language().utf8().data());
#endif
    }

    if (!m_firstInitializationSegmentReceived) {
        // 5. If active track flag equals true, then run the following steps:
        // 5.1. Add this SourceBuffer to activeSourceBuffers.
        // 5.2. Queue a task to fire a simple event named addsourcebuffer at
        // activesourcebuffers.
        m_source->setSourceBufferActive(this);

        // 6. Set first initialization segment received flag to true.
        m_firstInitializationSegmentReceived = true;
    }

    return result;
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:72,代码来源:SourceBuffer.cpp


注:本文中的VideoTrack::trackId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。