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

Side by Side Diff: media/cdm/ppapi/clear_key_cdm.h

Issue 93243003: Add CDM FileIO tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: not to use base::MessageLoopProxy::current() Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « media/cdm/ppapi/cdm_file_io_test.cc ('k') | media/cdm/ppapi/clear_key_cdm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_ 5 #ifndef MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_
6 #define MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_ 6 #define MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "media/cdm/aes_decryptor.h" 16 #include "media/cdm/aes_decryptor.h"
17 #include "media/cdm/ppapi/clear_key_cdm_common.h" 17 #include "media/cdm/ppapi/clear_key_cdm_common.h"
18 18
19 // Enable this to use the fake decoder for testing. 19 // Enable this to use the fake decoder for testing.
20 // TODO(tomfinegan): Move fake audio decoder into a separate class. 20 // TODO(tomfinegan): Move fake audio decoder into a separate class.
21 #if 0 21 #if 0
22 #define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 22 #define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
23 #endif 23 #endif
24 24
25 namespace media { 25 namespace media {
26 class FileIOTestRunner;
26 class CdmVideoDecoder; 27 class CdmVideoDecoder;
27 class DecoderBuffer; 28 class DecoderBuffer;
28 class FFmpegCdmAudioDecoder; 29 class FFmpegCdmAudioDecoder;
29 30
30 // Clear key implementation of the cdm::ContentDecryptionModule interface. 31 // Clear key implementation of the cdm::ContentDecryptionModule interface.
31 class ClearKeyCdm : public ClearKeyCdmInterface { 32 class ClearKeyCdm : public ClearKeyCdmInterface {
32 public: 33 public:
33 explicit ClearKeyCdm(Host* host, bool is_decrypt_only); 34 explicit ClearKeyCdm(Host* host,
35 bool is_decrypt_only,
36 bool should_test_file_io);
34 virtual ~ClearKeyCdm(); 37 virtual ~ClearKeyCdm();
35 38
36 // ContentDecryptionModule implementation. 39 // ContentDecryptionModule implementation.
37 virtual void CreateSession( 40 virtual void CreateSession(
38 uint32 session_id, 41 uint32 session_id,
39 const char* type, uint32 type_size, 42 const char* type, uint32 type_size,
40 const uint8* init_data, uint32 init_data_size) OVERRIDE; 43 const uint8* init_data, uint32 init_data_size) OVERRIDE;
41 virtual void UpdateSession( 44 virtual void UpdateSession(
42 uint32 session_id, 45 uint32 session_id,
43 const uint8* response, uint32 response_size) OVERRIDE; 46 const uint8* response, uint32 response_size) OVERRIDE;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Returns the number of samples generated in the |audio_frames|. 100 // Returns the number of samples generated in the |audio_frames|.
98 int GenerateFakeAudioFramesFromDuration(int64 duration_in_microseconds, 101 int GenerateFakeAudioFramesFromDuration(int64 duration_in_microseconds,
99 cdm::AudioFrames* audio_frames) const; 102 cdm::AudioFrames* audio_frames) const;
100 103
101 // Generates fake video frames given |input_timestamp|. 104 // Generates fake video frames given |input_timestamp|.
102 // Returns cdm::kSuccess if any audio frame is successfully generated. 105 // Returns cdm::kSuccess if any audio frame is successfully generated.
103 cdm::Status GenerateFakeAudioFrames(int64 timestamp_in_microseconds, 106 cdm::Status GenerateFakeAudioFrames(int64 timestamp_in_microseconds,
104 cdm::AudioFrames* audio_frames); 107 cdm::AudioFrames* audio_frames);
105 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 108 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
106 109
110 void StartFileIOTest();
111
112 // Callback for CDM File IO test.
113 void OnFileIOTestComplete(bool success);
114
107 AesDecryptor decryptor_; 115 AesDecryptor decryptor_;
108 116
109 ClearKeyCdmHost* host_; 117 ClearKeyCdmHost* host_;
110 118
111 const bool is_decrypt_only_; 119 const bool is_decrypt_only_;
120 const bool should_test_file_io_;
112 121
113 uint32 heartbeat_session_id_; 122 uint32 last_session_id_;
114 std::string next_heartbeat_message_; 123 std::string next_heartbeat_message_;
115 124
116 // Timer delay in milliseconds for the next host_->SetTimer() call. 125 // Timer delay in milliseconds for the next host_->SetTimer() call.
117 int64 timer_delay_ms_; 126 int64 timer_delay_ms_;
118 127
119 // Indicates whether a timer has been set to prevent multiple timers from 128 // Indicates whether a timer has been set to prevent multiple timers from
120 // running. 129 // running.
121 bool timer_set_; 130 bool timer_set_;
122 131
123 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) 132 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
124 int channel_count_; 133 int channel_count_;
125 int bits_per_channel_; 134 int bits_per_channel_;
126 int samples_per_second_; 135 int samples_per_second_;
127 int64 output_timestamp_base_in_microseconds_; 136 int64 output_timestamp_base_in_microseconds_;
128 int total_samples_generated_; 137 int total_samples_generated_;
129 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 138 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
130 139
131 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) 140 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
132 scoped_ptr<FFmpegCdmAudioDecoder> audio_decoder_; 141 scoped_ptr<FFmpegCdmAudioDecoder> audio_decoder_;
133 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER 142 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER
134 143
135 scoped_ptr<CdmVideoDecoder> video_decoder_; 144 scoped_ptr<CdmVideoDecoder> video_decoder_;
136 145
146 scoped_ptr<FileIOTestRunner> file_io_test_runner_;
147
137 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm); 148 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm);
138 }; 149 };
139 150
140 } // namespace media 151 } // namespace media
141 152
142 #endif // MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_ 153 #endif // MEDIA_CDM_PPAPI_CLEAR_KEY_CDM_H_
OLDNEW
« no previous file with comments | « media/cdm/ppapi/cdm_file_io_test.cc ('k') | media/cdm/ppapi/clear_key_cdm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698