OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "web/WebMediaPlayerClientImpl.h" | 6 #include "web/WebMediaPlayerClientImpl.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/html/HTMLMediaElement.h" | 9 #include "core/html/HTMLMediaElement.h" |
10 #include "core/html/TimeRanges.h" | 10 #include "core/html/TimeRanges.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 return m_webMediaPlayer.get(); | 66 return m_webMediaPlayer.get(); |
67 } | 67 } |
68 | 68 |
69 // WebMediaPlayerClient -------------------------------------------------------- | 69 // WebMediaPlayerClient -------------------------------------------------------- |
70 | 70 |
71 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() | 71 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() |
72 { | 72 { |
73 // Explicitly destroy the WebMediaPlayer to allow verification of tear down. | 73 // Explicitly destroy the WebMediaPlayer to allow verification of tear down. |
74 m_webMediaPlayer.clear(); | 74 m_webMediaPlayer.clear(); |
75 | 75 |
76 HTMLMediaElementEncryptedMedia::playerDestroyed(mediaElement()); | 76 if (m_client) |
77 HTMLMediaElementEncryptedMedia::playerDestroyed(mediaElement()); | |
78 } | |
79 | |
80 void WebMediaPlayerClientImpl::detach() | |
81 { | |
82 m_client = 0; | |
77 } | 83 } |
78 | 84 |
79 void WebMediaPlayerClientImpl::networkStateChanged() | 85 void WebMediaPlayerClientImpl::networkStateChanged() |
80 { | 86 { |
81 m_client->mediaPlayerNetworkStateChanged(); | 87 m_client->mediaPlayerNetworkStateChanged(); |
82 } | 88 } |
83 | 89 |
84 void WebMediaPlayerClientImpl::readyStateChanged() | 90 void WebMediaPlayerClientImpl::readyStateChanged() |
85 { | 91 { |
86 m_client->mediaPlayerReadyStateChanged(); | 92 m_client->mediaPlayerReadyStateChanged(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 HTMLMediaElementEncryptedMedia::keyMessage(mediaElement(), keySystem, sessio nId, message, messageLength, defaultURL); | 142 HTMLMediaElementEncryptedMedia::keyMessage(mediaElement(), keySystem, sessio nId, message, messageLength, defaultURL); |
137 } | 143 } |
138 | 144 |
139 void WebMediaPlayerClientImpl::keyNeeded(const WebString& contentType, const uns igned char* initData, unsigned initDataLength) | 145 void WebMediaPlayerClientImpl::keyNeeded(const WebString& contentType, const uns igned char* initData, unsigned initDataLength) |
140 { | 146 { |
141 HTMLMediaElementEncryptedMedia::keyNeeded(mediaElement(), contentType, initD ata, initDataLength); | 147 HTMLMediaElementEncryptedMedia::keyNeeded(mediaElement(), contentType, initD ata, initDataLength); |
142 } | 148 } |
143 | 149 |
144 void WebMediaPlayerClientImpl::setWebLayer(blink::WebLayer* layer) | 150 void WebMediaPlayerClientImpl::setWebLayer(blink::WebLayer* layer) |
145 { | 151 { |
146 m_client->mediaPlayerSetWebLayer(layer); | 152 ASSERT(m_client || !layer); |
haraken
2014/05/27 23:09:09
Nit: I wonder why you need this ASSERT.
sof
2014/05/28 05:28:18
To check that the embedder only tries to clear the
| |
153 if (m_client) | |
154 m_client->mediaPlayerSetWebLayer(layer); | |
147 } | 155 } |
148 | 156 |
149 void WebMediaPlayerClientImpl::addTextTrack(WebInbandTextTrack* textTrack) | 157 void WebMediaPlayerClientImpl::addTextTrack(WebInbandTextTrack* textTrack) |
150 { | 158 { |
151 m_client->mediaPlayerDidAddTextTrack(textTrack); | 159 m_client->mediaPlayerDidAddTextTrack(textTrack); |
152 } | 160 } |
153 | 161 |
154 void WebMediaPlayerClientImpl::removeTextTrack(WebInbandTextTrack* textTrack) | 162 void WebMediaPlayerClientImpl::removeTextTrack(WebInbandTextTrack* textTrack) |
155 { | 163 { |
156 m_client->mediaPlayerDidRemoveTextTrack(textTrack); | 164 m_client->mediaPlayerDidRemoveTextTrack(textTrack); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 | 499 |
492 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) | 500 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) |
493 { | 501 { |
494 if (m_client) | 502 if (m_client) |
495 m_client->setFormat(numberOfChannels, sampleRate); | 503 m_client->setFormat(numberOfChannels, sampleRate); |
496 } | 504 } |
497 | 505 |
498 #endif | 506 #endif |
499 | 507 |
500 } // namespace blink | 508 } // namespace blink |
OLD | NEW |