OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // IPC messages for android media player. | 5 // IPC messages for android media player. |
6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 #include "media/base/android/demuxer_stream_player_params.h" | |
12 #include "media/base/decrypt_config.h" | |
13 #include "media/blink/renderer_media_player_interface.h" | 11 #include "media/blink/renderer_media_player_interface.h" |
14 #include "media/gpu/ipc/common/media_param_traits.h" | 12 #include "media/gpu/ipc/common/media_param_traits.h" |
15 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
16 #include "url/gurl.h" | 14 #include "url/gurl.h" |
17 | 15 |
18 #undef IPC_MESSAGE_EXPORT | 16 #undef IPC_MESSAGE_EXPORT |
19 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
20 #define IPC_MESSAGE_START MediaPlayerMsgStart | 18 #define IPC_MESSAGE_START MediaPlayerMsgStart |
21 | 19 |
22 IPC_ENUM_TRAITS(media::AudioCodec) | |
23 IPC_ENUM_TRAITS(media::DemuxerStream::Status) | |
24 IPC_ENUM_TRAITS(media::DemuxerStream::Type) | |
25 IPC_ENUM_TRAITS(media::VideoCodec) | |
26 | |
27 IPC_STRUCT_TRAITS_BEGIN(media::DemuxerConfigs) | |
28 IPC_STRUCT_TRAITS_MEMBER(audio_codec) | |
29 IPC_STRUCT_TRAITS_MEMBER(audio_channels) | |
30 IPC_STRUCT_TRAITS_MEMBER(audio_sampling_rate) | |
31 IPC_STRUCT_TRAITS_MEMBER(is_audio_encrypted) | |
32 IPC_STRUCT_TRAITS_MEMBER(audio_extra_data) | |
33 IPC_STRUCT_TRAITS_MEMBER(audio_codec_delay_ns) | |
34 IPC_STRUCT_TRAITS_MEMBER(audio_seek_preroll_ns) | |
35 | |
36 IPC_STRUCT_TRAITS_MEMBER(video_codec) | |
37 IPC_STRUCT_TRAITS_MEMBER(video_size) | |
38 IPC_STRUCT_TRAITS_MEMBER(is_video_encrypted) | |
39 IPC_STRUCT_TRAITS_MEMBER(video_extra_data) | |
40 | |
41 IPC_STRUCT_TRAITS_MEMBER(duration) | |
42 IPC_STRUCT_TRAITS_END() | |
43 | |
44 IPC_STRUCT_TRAITS_BEGIN(media::DemuxerData) | |
45 IPC_STRUCT_TRAITS_MEMBER(type) | |
46 IPC_STRUCT_TRAITS_MEMBER(access_units) | |
47 IPC_STRUCT_TRAITS_MEMBER(demuxer_configs) | |
48 IPC_STRUCT_TRAITS_END() | |
49 | |
50 IPC_STRUCT_TRAITS_BEGIN(media::AccessUnit) | |
51 IPC_STRUCT_TRAITS_MEMBER(status) | |
52 IPC_STRUCT_TRAITS_MEMBER(is_end_of_stream) | |
53 IPC_STRUCT_TRAITS_MEMBER(data) | |
54 IPC_STRUCT_TRAITS_MEMBER(timestamp) | |
55 IPC_STRUCT_TRAITS_MEMBER(key_id) | |
56 IPC_STRUCT_TRAITS_MEMBER(iv) | |
57 IPC_STRUCT_TRAITS_MEMBER(subsamples) | |
58 IPC_STRUCT_TRAITS_MEMBER(is_key_frame) | |
59 IPC_STRUCT_TRAITS_END() | |
60 | |
61 IPC_ENUM_TRAITS_MAX_VALUE(MediaPlayerHostMsg_Initialize_Type, | 20 IPC_ENUM_TRAITS_MAX_VALUE(MediaPlayerHostMsg_Initialize_Type, |
62 MEDIA_PLAYER_TYPE_LAST) | 21 MEDIA_PLAYER_TYPE_LAST) |
63 | 22 |
64 // Parameters to describe a media player | 23 // Parameters to describe a media player |
65 IPC_STRUCT_BEGIN(MediaPlayerHostMsg_Initialize_Params) | 24 IPC_STRUCT_BEGIN(MediaPlayerHostMsg_Initialize_Params) |
66 IPC_STRUCT_MEMBER(MediaPlayerHostMsg_Initialize_Type, type) | 25 IPC_STRUCT_MEMBER(MediaPlayerHostMsg_Initialize_Type, type) |
67 IPC_STRUCT_MEMBER(int, player_id) | 26 IPC_STRUCT_MEMBER(int, player_id) |
68 IPC_STRUCT_MEMBER(int, demuxer_client_id) | |
69 IPC_STRUCT_MEMBER(GURL, url) | 27 IPC_STRUCT_MEMBER(GURL, url) |
70 IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) | 28 IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) |
71 IPC_STRUCT_MEMBER(GURL, frame_url) | 29 IPC_STRUCT_MEMBER(GURL, frame_url) |
72 IPC_STRUCT_MEMBER(bool, allow_credentials) | 30 IPC_STRUCT_MEMBER(bool, allow_credentials) |
73 IPC_STRUCT_MEMBER(int, delegate_id) | 31 IPC_STRUCT_MEMBER(int, delegate_id) |
74 IPC_STRUCT_END() | 32 IPC_STRUCT_END() |
75 | 33 |
76 // Chrome for Android seek message sequence is: | 34 // Chrome for Android seek message sequence is: |
77 // 1. Renderer->Browser MediaPlayerHostMsg_Seek | 35 // 1. Renderer->Browser MediaPlayerHostMsg_Seek |
78 // This is the beginning of actual seek flow in response to web app requests | 36 // This is the beginning of actual seek flow in response to web app requests |
79 // for seeks and browser MediaPlayerMsg_SeekRequests. With this message, | 37 // for seeks and browser MediaPlayerMsg_SeekRequests. With this message, |
80 // the renderer asks browser to perform actual seek. At most one of these | 38 // the renderer asks browser to perform actual seek. At most one of these |
81 // actual seeks will be in process between this message and renderer's later | 39 // actual seeks will be in process between this message and renderer's later |
82 // receipt of MediaPlayerMsg_SeekCompleted from the browser. | 40 // receipt of MediaPlayerMsg_SeekCompleted from the browser. |
83 // 2. Browser->Renderer MediaPlayerMsg_SeekCompleted | 41 // 2. Browser->Renderer MediaPlayerMsg_SeekCompleted |
84 // Once the browser determines the seek is complete, it sends this message to | 42 // Once the browser determines the seek is complete, it sends this message to |
85 // notify the renderer of seek completion. | 43 // notify the renderer of seek completion. |
86 // | 44 // |
87 // Other seek-related IPC messages: | 45 // Other seek-related IPC messages: |
88 // Browser->Renderer MediaPlayerMsg_SeekRequest | 46 // Browser->Renderer MediaPlayerMsg_SeekRequest |
89 // Browser requests to begin a seek. All browser-initiated seeks must begin | 47 // Browser requests to begin a seek. All browser-initiated seeks must begin |
90 // with this request. Renderer controls actual seek initiation via the normal | 48 // with this request. Renderer controls actual seek initiation via the normal |
91 // seek flow, above, keeping web apps aware of seeks. These requests are | 49 // seek flow, above, keeping web apps aware of seeks. These requests are |
92 // also allowed while another actual seek is in progress. | 50 // also allowed while another actual seek is in progress. |
93 // | 51 // |
94 // If the demuxer is located in the renderer, as in media source players, the | |
95 // browser must ensure the renderer demuxer is appropriately seeked between | |
96 // receipt of MediaPlayerHostMsg_Seek and transmission of | |
97 // MediaPlayerMsg_SeekCompleted. The following two renderer-demuxer control | |
98 // messages book-end the renderer-demuxer seek: | |
99 // 1.1 Browser->Renderer MediaPlayerMsg_DemuxerSeekRequest | |
100 // 1.2 Renderer->Browser MediaPlayerHostMsg_DemuxerSeekDone | |
101 | |
102 // Only in short-term hack to seek to reach I-Frame to feed a newly constructed | |
103 // video decoder may the above IPC sequence be modified to exclude SeekRequest, | |
104 // Seek and SeekCompleted, with condition that DemuxerSeekRequest's | |
105 // |is_browser_seek| parameter be true. Regular seek messages must still be | |
106 // handled even when a hack browser seek is in progress. In this case, the | |
107 // browser seek request's |time_to_seek| may no longer be buffered and the | |
108 // demuxer may instead seek to a future buffered time. The resulting | |
109 // DemuxerSeekDone message's |actual_browser_seek_time| is the time actually | |
110 // seeked-to, and is only meaningful for these hack browser seeks. | |
111 // TODO(wolenetz): Instead of doing browser seek, replay cached data since last | |
112 // keyframe. See http://crbug.com/304234. | |
113 | |
114 // Messages for notifying the render process of media playback status ------- | 52 // Messages for notifying the render process of media playback status ------- |
115 | 53 |
116 // Media buffering has updated. | 54 // Media buffering has updated. |
117 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_MediaBufferingUpdate, | 55 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_MediaBufferingUpdate, |
118 int /* player_id */, | 56 int /* player_id */, |
119 int /* percent */) | 57 int /* percent */) |
120 | 58 |
121 // A media playback error has occurred. | 59 // A media playback error has occurred. |
122 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_MediaError, | 60 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_MediaError, |
123 int /* player_id */, | 61 int /* player_id */, |
(...skipping 26 matching lines...) Expand all Loading... |
150 int /* player_id */, | 88 int /* player_id */, |
151 int /* width */, | 89 int /* width */, |
152 int /* height */) | 90 int /* height */) |
153 | 91 |
154 // The current play time has updated. | 92 // The current play time has updated. |
155 IPC_MESSAGE_ROUTED3(MediaPlayerMsg_MediaTimeUpdate, | 93 IPC_MESSAGE_ROUTED3(MediaPlayerMsg_MediaTimeUpdate, |
156 int /* player_id */, | 94 int /* player_id */, |
157 base::TimeDelta /* current_timestamp */, | 95 base::TimeDelta /* current_timestamp */, |
158 base::TimeTicks /* current_time_ticks */) | 96 base::TimeTicks /* current_time_ticks */) |
159 | 97 |
160 // A new key is required in order to continue decrypting encrypted content. | |
161 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_WaitingForDecryptionKey, int /* player_id */) | |
162 | |
163 // The player has been released. | 98 // The player has been released. |
164 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_MediaPlayerReleased, | 99 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_MediaPlayerReleased, |
165 int /* player_id */) | 100 int /* player_id */) |
166 | 101 |
167 // The player exited fullscreen. | 102 // The player exited fullscreen. |
168 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidExitFullscreen, | 103 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidExitFullscreen, |
169 int /* player_id */) | 104 int /* player_id */) |
170 | 105 |
171 // The player started playing. | 106 // The player started playing. |
172 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidMediaPlayerPlay, | 107 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidMediaPlayerPlay, |
173 int /* player_id */) | 108 int /* player_id */) |
174 | 109 |
175 // The player was paused. | 110 // The player was paused. |
176 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidMediaPlayerPause, | 111 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DidMediaPlayerPause, |
177 int /* player_id */) | 112 int /* player_id */) |
178 | 113 |
179 // Requests renderer demuxer seek. | |
180 IPC_MESSAGE_CONTROL3(MediaPlayerMsg_DemuxerSeekRequest, | |
181 int /* demuxer_client_id */, | |
182 base::TimeDelta /* time_to_seek */, | |
183 bool /* is_browser_seek */) | |
184 | |
185 // The media source player reads data from demuxer | |
186 IPC_MESSAGE_CONTROL2(MediaPlayerMsg_ReadFromDemuxer, | |
187 int /* demuxer_client_id */, | |
188 media::DemuxerStream::Type /* type */) | |
189 | |
190 // Clank has connected to the remote device. | 114 // Clank has connected to the remote device. |
191 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_ConnectedToRemoteDevice, | 115 IPC_MESSAGE_ROUTED2(MediaPlayerMsg_ConnectedToRemoteDevice, |
192 int /* player_id */, | 116 int /* player_id */, |
193 std::string /* remote_playback_message */) | 117 std::string /* remote_playback_message */) |
194 | 118 |
195 // Clank has disconnected from the remote device. | 119 // Clank has disconnected from the remote device. |
196 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DisconnectedFromRemoteDevice, | 120 IPC_MESSAGE_ROUTED1(MediaPlayerMsg_DisconnectedFromRemoteDevice, |
197 int /* player_id */) | 121 int /* player_id */) |
198 | 122 |
199 // The remote playback device selection has been cancelled. | 123 // The remote playback device selection has been cancelled. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Set the poster image. | 164 // Set the poster image. |
241 IPC_MESSAGE_ROUTED2(MediaPlayerHostMsg_SetPoster, | 165 IPC_MESSAGE_ROUTED2(MediaPlayerHostMsg_SetPoster, |
242 int /* player_id */, | 166 int /* player_id */, |
243 GURL /* poster url */) | 167 GURL /* poster url */) |
244 | 168 |
245 // Requests the player to enter fullscreen. | 169 // Requests the player to enter fullscreen. |
246 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_EnterFullscreen, int /* player_id */) | 170 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_EnterFullscreen, int /* player_id */) |
247 | 171 |
248 // Play the media on a remote device, if possible. | 172 // Play the media on a remote device, if possible. |
249 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_RequestRemotePlayback, | 173 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_RequestRemotePlayback, |
250 int /* demuxer_client_id */) | 174 int /* player_id */) |
251 | 175 |
252 // Control media playing on a remote device. | 176 // Control media playing on a remote device. |
253 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_RequestRemotePlaybackControl, | 177 IPC_MESSAGE_ROUTED1(MediaPlayerHostMsg_RequestRemotePlaybackControl, |
254 int /* demuxer_client_id */) | 178 int /* player_id */) |
255 | 179 |
256 // Requests the player with |player_id| to use the CDM with |cdm_id|. | 180 // Requests the player with |player_id| to use the CDM with |cdm_id|. |
257 IPC_MESSAGE_ROUTED2(MediaPlayerHostMsg_SetCdm, | 181 IPC_MESSAGE_ROUTED2(MediaPlayerHostMsg_SetCdm, |
258 int /* player_id */, | 182 int /* player_id */, |
259 int /* cdm_id */) | 183 int /* cdm_id */) |
260 | |
261 // Sent after the renderer demuxer has seeked. | |
262 IPC_MESSAGE_CONTROL2(MediaPlayerHostMsg_DemuxerSeekDone, | |
263 int /* demuxer_client_id */, | |
264 base::TimeDelta /* actual_browser_seek_time */) | |
265 | |
266 // Inform the media source player that the demuxer is ready. | |
267 IPC_MESSAGE_CONTROL2(MediaPlayerHostMsg_DemuxerReady, | |
268 int /* demuxer_client_id */, | |
269 media::DemuxerConfigs) | |
270 | |
271 // Sent when the data was read from the ChunkDemuxer. | |
272 IPC_MESSAGE_CONTROL2(MediaPlayerHostMsg_ReadFromDemuxerAck, | |
273 int /* demuxer_client_id */, | |
274 media::DemuxerData) | |
275 | |
276 // Inform the media source player of changed media duration from demuxer. | |
277 IPC_MESSAGE_CONTROL2(MediaPlayerHostMsg_DurationChanged, | |
278 int /* demuxer_client_id */, | |
279 base::TimeDelta /* duration */) | |
OLD | NEW |