Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2263823002: Deliver change notifications to SourceBuffer track lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update activeSourceBuffers on track status changes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 else 2393 else
2394 pause(); 2394 pause();
2395 } 2395 }
2396 2396
2397 AudioTrackList& HTMLMediaElement::audioTracks() 2397 AudioTrackList& HTMLMediaElement::audioTracks()
2398 { 2398 {
2399 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2399 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2400 return *m_audioTracks; 2400 return *m_audioTracks;
2401 } 2401 }
2402 2402
2403 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled) 2403 void HTMLMediaElement::audioTrackChanged(AudioTrack* track, bool enabled)
mlamouri (slow - plz ping) 2016/08/23 13:12:27 Do you still need `enabled`? It sounds like you co
servolk 2016/08/23 17:25:02 Done.
2404 { 2404 {
2405 BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this << ") trackId= " << S tring(trackId) << " enabled=" << boolString(enabled); 2405 BLINK_MEDIA_LOG << "audioTrackChanged(" << (void*)this << ") trackId= " << S tring(track->id()) << " enabled=" << boolString(enabled);
2406 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2406 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2407 2407
2408 audioTracks().scheduleChangeEvent(); 2408 audioTracks().scheduleChangeEvent();
2409 2409
2410 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added. 2410 if (m_mediaSource)
2411 m_mediaSource->onTrackChanged(track);
2411 2412
2412 if (!m_audioTracksTimer.isActive()) 2413 if (!m_audioTracksTimer.isActive())
2413 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); 2414 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE);
2414 } 2415 }
2415 2416
2416 void HTMLMediaElement::audioTracksTimerFired(TimerBase*) 2417 void HTMLMediaElement::audioTracksTimerFired(TimerBase*)
2417 { 2418 {
2418 Vector<WebMediaPlayer::TrackId> enabledTrackIds; 2419 Vector<WebMediaPlayer::TrackId> enabledTrackIds;
2419 for (unsigned i = 0; i < audioTracks().length(); ++i) { 2420 for (unsigned i = 0; i < audioTracks().length(); ++i) {
2420 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); 2421 AudioTrack* track = audioTracks().anonymousIndexedGetter(i);
(...skipping 28 matching lines...) Expand all
2449 2450
2450 audioTracks().remove(trackId); 2451 audioTracks().remove(trackId);
2451 } 2452 }
2452 2453
2453 VideoTrackList& HTMLMediaElement::videoTracks() 2454 VideoTrackList& HTMLMediaElement::videoTracks()
2454 { 2455 {
2455 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2456 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2456 return *m_videoTracks; 2457 return *m_videoTracks;
2457 } 2458 }
2458 2459
2459 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId) 2460 void HTMLMediaElement::selectedVideoTrackChanged(VideoTrack* track, bool selecte d)
mlamouri (slow - plz ping) 2016/08/23 13:12:27 ditto for `selected`
servolk 2016/08/23 17:25:02 Done.
2460 { 2461 {
2461 BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this << ") selecte dTrackId=" << (selectedTrackId ? String(*selectedTrackId) : "none"); 2462 BLINK_MEDIA_LOG << "selectedVideoTrackChanged(" << (void*)this << ") selecte dTrackId=" << (selected ? String(track->id()) : "none");
2462 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2463 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2463 2464
2464 if (selectedTrackId) 2465 if (selected)
2465 videoTracks().trackSelected(*selectedTrackId); 2466 videoTracks().trackSelected(track->id());
2466 2467
2467 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added. 2468 videoTracks().scheduleChangeEvent();
2468 2469
2469 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); 2470 if (m_mediaSource)
2471 m_mediaSource->onTrackChanged(track);
2472
2473 WebMediaPlayer::TrackId id = track->id();
2474 webMediaPlayer()->selectedVideoTrackChanged(selected ? &id : nullptr);
2470 } 2475 }
2471 2476
2472 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) 2477 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected)
2473 { 2478 {
2474 AtomicString kindString = VideoKindToString(kind); 2479 AtomicString kindString = VideoKindToString(kind);
2475 BLINK_MEDIA_LOG << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kindString 2480 BLINK_MEDIA_LOG << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kindString
2476 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")"; 2481 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")";
2477 2482
2478 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2483 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2479 return blink::WebMediaPlayer::TrackId(); 2484 return blink::WebMediaPlayer::TrackId();
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 4018
4014 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 4019 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
4015 { 4020 {
4016 IntRect result; 4021 IntRect result;
4017 if (LayoutObject* object = m_element->layoutObject()) 4022 if (LayoutObject* object = m_element->layoutObject())
4018 result = object->absoluteBoundingBoxRect(); 4023 result = object->absoluteBoundingBoxRect();
4019 return result; 4024 return result;
4020 } 4025 }
4021 4026
4022 } // namespace blink 4027 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698