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

Side by Side Diff: ppapi/shared_impl/media_stream_frame.h

Issue 140783004: [PPAPI] Pepper MediaStream API audio track implementation and example. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 6 years, 11 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_ 5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_ 6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_
7 7
8 #include "ppapi/c/ppb_audio_frame.h"
8 #include "ppapi/c/ppb_video_frame.h" 9 #include "ppapi/c/ppb_video_frame.h"
9 10
10 namespace ppapi { 11 namespace ppapi {
11 12
12 union MediaStreamFrame { 13 union MediaStreamFrame {
13 enum Type { 14 enum Type {
14 TYPE_UNKNOWN = 0, 15 TYPE_UNKNOWN = 0,
15 TYPE_AUDIO = 1, 16 TYPE_AUDIO = 1,
16 TYPE_VIDEO = 2, 17 TYPE_VIDEO = 2,
17 }; 18 };
18 19
19 struct Header { 20 struct Header {
20 Type type; 21 Type type;
21 uint32_t size; 22 uint32_t size;
22 }; 23 };
23 24
24 struct Audio { 25 struct Audio {
25 Header header; 26 Header header;
26 // TODO(penghuang): implement the audio frame. 27 PP_TimeDelta timestamp;
28 PP_AudioSampleRate sample_rate;
29 uint32_t number_of_channels;
30 uint32_t number_of_samples;
31 uint32_t data_size;
32 // Uses 8 bytes to make sure the Audio struct has consistent size between
33 // Nacl code and renderer code.
dmichael (off chromium) 2014/01/16 22:34:20 nit: s/Nacl/NaCl
Peng 2014/01/17 00:23:49 Done.
34 uint8_t data[8];
27 }; 35 };
28 36
29 struct Video { 37 struct Video {
30 Header header; 38 Header header;
31 PP_TimeDelta timestamp; 39 PP_TimeDelta timestamp;
32 PP_VideoFrame_Format format; 40 PP_VideoFrame_Format format;
33 PP_Size size; 41 PP_Size size;
34 uint32_t data_size; 42 uint32_t data_size;
35 // Uses 8 bytes to make sure the Video struct has consistent size between 43 // Uses 8 bytes to make sure the Video struct has consistent size between
36 // Nacl code and renderer code. 44 // Nacl code and renderer code.
37 uint8_t data[8]; 45 uint8_t data[8];
38 }; 46 };
39 47
40 // Because these structs are written and read in shared memory, we need 48 // Because these structs are written and read in shared memory, we need
41 // the size and alighment to be consistent between NaCl and its host trusted 49 // the size and alighment to be consistent between NaCl and its host trusted
42 // platform. 50 // platform.
43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Header, 8); 51 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Header, 8);
44 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Audio, 8); 52 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Audio, 40);
45 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Video, 40); 53 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Video, 40);
46 54
47 Header header; 55 Header header;
48 Video video; 56 Video video;
49 Audio audio; 57 Audio audio;
50 }; 58 };
51 59
52 } // namespace ppapi 60 } // namespace ppapi
53 61
54 #endif // PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_ 62 #endif // PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698