Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 } | 578 } |
| 579 | 579 |
| 580 WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c onst WebVector<MediaTrackInfo>& newTracks) | 580 WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c onst WebVector<MediaTrackInfo>& newTracks) |
| 581 { | 581 { |
| 582 DVLOG(SOURCE_BUFFER_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") tracks=" << newTracks.size(); | 582 DVLOG(SOURCE_BUFFER_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") tracks=" << newTracks.size(); |
| 583 DCHECK(m_source); | 583 DCHECK(m_source); |
| 584 DCHECK(m_source->mediaElement()); | 584 DCHECK(m_source->mediaElement()); |
| 585 DCHECK(m_updating); | 585 DCHECK(m_updating); |
| 586 | 586 |
| 587 // TODO(servolk): Implement proper 'initialization segment received' algorit hm according to MSE spec: | 587 // TODO(servolk): Implement proper 'initialization segment received' algorit hm according to MSE spec: |
| 588 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received | 588 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received |
|
wolenetz
2016/06/09 19:20:58
There can be an N:1 {HTMLMediaElement,SourceBuffer
servolk
2016/06/09 20:42:04
Yes, I remember that there might be multiple kinds
| |
| 589 WebVector<WebMediaPlayer::TrackId> result(newTracks.size()); | 589 WebVector<WebMediaPlayer::TrackId> result(newTracks.size()); |
| 590 unsigned resultIdx = 0; | 590 unsigned resultIdx = 0; |
| 591 for (const auto& trackInfo : newTracks) { | 591 for (const auto& trackInfo : newTracks) { |
| 592 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { | 592 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { |
| 593 static WebMediaPlayer::TrackId nextTrackId = 0; | 593 static unsigned nextTrackId = 0; |
| 594 result[resultIdx++] = ++nextTrackId; | 594 StringBuilder stringBuilder; |
| 595 stringBuilder.appendNumber(++nextTrackId); | |
| 596 result[resultIdx++] = stringBuilder.toString(); | |
| 595 continue; | 597 continue; |
| 596 } | 598 } |
| 597 | 599 |
| 598 const TrackBase* trackBase = nullptr; | 600 const TrackBase* trackBase = nullptr; |
| 599 if (trackInfo.trackType == WebMediaPlayer::AudioTrack) { | 601 if (trackInfo.trackType == WebMediaPlayer::AudioTrack) { |
| 600 AudioTrack* audioTrack = nullptr; | 602 AudioTrack* audioTrack = nullptr; |
| 601 if (!m_firstInitializationSegmentReceived) { | 603 if (!m_firstInitializationSegmentReceived) { |
| 602 audioTrack = AudioTrack::create(trackInfo.byteStreamTrackId, tra ckInfo.kind, trackInfo.label, trackInfo.language, false); | 604 audioTrack = AudioTrack::create(trackInfo.byteStreamTrackId, tra ckInfo.kind, trackInfo.label, trackInfo.language, false); |
| 603 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, th is); | 605 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, th is); |
| 604 audioTracks().add(audioTrack); | 606 audioTracks().add(audioTrack); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 623 trackBase = videoTrack; | 625 trackBase = videoTrack; |
| 624 result[resultIdx++] = videoTrack->trackId(); | 626 result[resultIdx++] = videoTrack->trackId(); |
| 625 } else { | 627 } else { |
| 626 NOTREACHED(); | 628 NOTREACHED(); |
| 627 } | 629 } |
| 628 (void)trackBase; | 630 (void)trackBase; |
| 629 #if !LOG_DISABLED | 631 #if !LOG_DISABLED |
| 630 const char* logActionStr = m_firstInitializationSegmentReceived ? "using existing" : "added"; | 632 const char* logActionStr = m_firstInitializationSegmentReceived ? "using existing" : "added"; |
| 631 const char* logTrackTypeStr = (trackInfo.trackType == WebMediaPlayer::Au dioTrack) ? "audio" : "video"; | 633 const char* logTrackTypeStr = (trackInfo.trackType == WebMediaPlayer::Au dioTrack) ? "audio" : "video"; |
| 632 DVLOG(SOURCE_BUFFER_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << logActionStr << " " | 634 DVLOG(SOURCE_BUFFER_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << logActionStr << " " |
| 633 << logTrackTypeStr << " Track " << trackBase << "trackId=" << trackB ase->trackId() << " id=" | 635 << logTrackTypeStr << " Track " << trackBase << " trackId=" << (Stri ng)trackBase->trackId() |
| 634 << trackBase->id() << " label=" << trackBase->label() << " lang=" << trackBase->language(); | 636 << " label=" << trackBase->label() << " lang=" << trackBase->languag e(); |
| 635 #endif | 637 #endif |
| 636 } | 638 } |
| 637 | 639 |
| 638 if (!m_firstInitializationSegmentReceived) { | 640 if (!m_firstInitializationSegmentReceived) { |
| 639 // 5. If active track flag equals true, then run the following steps: | 641 // 5. If active track flag equals true, then run the following steps: |
| 640 // 5.1. Add this SourceBuffer to activeSourceBuffers. | 642 // 5.1. Add this SourceBuffer to activeSourceBuffers. |
| 641 // 5.2. Queue a task to fire a simple event named addsourcebuffer at | 643 // 5.2. Queue a task to fire a simple event named addsourcebuffer at |
| 642 // activesourcebuffers. | 644 // activesourcebuffers. |
| 643 m_source->setSourceBufferActive(this); | 645 m_source->setSourceBufferActive(this); |
| 644 | 646 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1026 visitor->trace(m_removeAsyncPartRunner); | 1028 visitor->trace(m_removeAsyncPartRunner); |
| 1027 visitor->trace(m_appendStreamAsyncPartRunner); | 1029 visitor->trace(m_appendStreamAsyncPartRunner); |
| 1028 visitor->trace(m_stream); | 1030 visitor->trace(m_stream); |
| 1029 visitor->trace(m_audioTracks); | 1031 visitor->trace(m_audioTracks); |
| 1030 visitor->trace(m_videoTracks); | 1032 visitor->trace(m_videoTracks); |
| 1031 EventTargetWithInlineData::trace(visitor); | 1033 EventTargetWithInlineData::trace(visitor); |
| 1032 ActiveDOMObject::trace(visitor); | 1034 ActiveDOMObject::trace(visitor); |
| 1033 } | 1035 } |
| 1034 | 1036 |
| 1035 } // namespace blink | 1037 } // namespace blink |
| OLD | NEW |