Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2401 else | 2401 else |
| 2402 pause(); | 2402 pause(); |
| 2403 } | 2403 } |
| 2404 | 2404 |
| 2405 AudioTrackList& HTMLMediaElement::audioTracks() | 2405 AudioTrackList& HTMLMediaElement::audioTracks() |
| 2406 { | 2406 { |
| 2407 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2407 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2408 return *m_audioTracks; | 2408 return *m_audioTracks; |
| 2409 } | 2409 } |
| 2410 | 2410 |
| 2411 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled) | 2411 void HTMLMediaElement::audioTrackChanged(AudioTrack* track) |
| 2412 { | 2412 { |
| 2413 BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this << ") trackId= " << S tring(trackId) << " enabled=" << boolString(enabled); | 2413 BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this << ") trackId= " << S tring(track->id()) << " enabled=" << boolString(track->enabled()); |
| 2414 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2414 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2415 | 2415 |
| 2416 audioTracks().scheduleChangeEvent(); | 2416 audioTracks().scheduleChangeEvent(); |
| 2417 | 2417 |
| 2418 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added. | 2418 if (m_mediaSource) |
| 2419 m_mediaSource->onTrackChanged(track); | |
| 2419 | 2420 |
| 2420 if (!m_audioTracksTimer.isActive()) | 2421 if (!m_audioTracksTimer.isActive()) |
| 2421 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); | 2422 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); |
| 2422 } | 2423 } |
| 2423 | 2424 |
| 2424 void HTMLMediaElement::audioTracksTimerFired(TimerBase*) | 2425 void HTMLMediaElement::audioTracksTimerFired(TimerBase*) |
| 2425 { | 2426 { |
| 2426 Vector<WebMediaPlayer::TrackId> enabledTrackIds; | 2427 Vector<WebMediaPlayer::TrackId> enabledTrackIds; |
| 2427 for (unsigned i = 0; i < audioTracks().length(); ++i) { | 2428 for (unsigned i = 0; i < audioTracks().length(); ++i) { |
| 2428 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); | 2429 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2457 | 2458 |
| 2458 audioTracks().remove(trackId); | 2459 audioTracks().remove(trackId); |
| 2459 } | 2460 } |
| 2460 | 2461 |
| 2461 VideoTrackList& HTMLMediaElement::videoTracks() | 2462 VideoTrackList& HTMLMediaElement::videoTracks() |
| 2462 { | 2463 { |
| 2463 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2464 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2464 return *m_videoTracks; | 2465 return *m_videoTracks; |
| 2465 } | 2466 } |
| 2466 | 2467 |
| 2467 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId) | 2468 void HTMLMediaElement::selectedVideoTrackChanged(VideoTrack* track) |
| 2468 { | 2469 { |
| 2469 BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this << ") selecte dTrackId=" << (selectedTrackId ? String(*selectedTrackId) : "none"); | 2470 BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this << ") selecte dTrackId=" << (track->selected() ? String(track->id()) : "none"); |
| 2470 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2471 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| 2471 | 2472 |
| 2472 if (selectedTrackId) | 2473 if (track->selected()) |
| 2473 videoTracks().trackSelected(*selectedTrackId); | 2474 videoTracks().trackSelected(track->id()); |
| 2474 | 2475 |
| 2475 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added. | 2476 videoTracks().scheduleChangeEvent(); |
| 2476 | 2477 |
| 2477 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); | 2478 if (m_mediaSource) |
| 2479 m_mediaSource->onTrackChanged(track); | |
| 2480 | |
| 2481 WebMediaPlayer::TrackId id = track->id(); | |
| 2482 webMediaPlayer()->selectedVideoTrackChanged(track->selected() ? &id : nullpt r); | |
|
mlamouri (slow - plz ping)
2016/08/24 16:08:46
Should you pass `&track->id()` instead of making a
servolk
2016/08/25 00:50:18
No, that causes an error:
../../third_party/WebKit
| |
| 2478 } | 2483 } |
| 2479 | 2484 |
| 2480 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) | 2485 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) |
| 2481 { | 2486 { |
| 2482 AtomicString kindString = VideoKindToString(kind); | 2487 AtomicString kindString = VideoKindToString(kind); |
| 2483 BLINK_MEDIA_LOG << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kindString | 2488 BLINK_MEDIA_LOG << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kindString |
| 2484 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")"; | 2489 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")"; |
| 2485 | 2490 |
| 2486 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) | 2491 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| 2487 return blink::WebMediaPlayer::TrackId(); | 2492 return blink::WebMediaPlayer::TrackId(); |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4022 | 4027 |
| 4023 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst | 4028 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst |
| 4024 { | 4029 { |
| 4025 IntRect result; | 4030 IntRect result; |
| 4026 if (LayoutObject* object = m_element->layoutObject()) | 4031 if (LayoutObject* object = m_element->layoutObject()) |
| 4027 result = object->absoluteBoundingBoxRect(); | 4032 result = object->absoluteBoundingBoxRect(); |
| 4028 return result; | 4033 return result; |
| 4029 } | 4034 } |
| 4030 | 4035 |
| 4031 } // namespace blink | 4036 } // namespace blink |
| OLD | NEW |