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

Unified Diff: webkit/plugins/ppapi/content_decryptor_delegate.cc

Issue 17315021: Refactored DataBuffer to use unix_hacker style methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed accidental renaming of test cases. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/content_decryptor_delegate.cc
diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.cc b/webkit/plugins/ppapi/content_decryptor_delegate.cc
index f682c444d9c63c68368ae3d935cf2087b0967b44..2a6cee6b3458c827bdd54ed991d2cdc128dd55fd 100644
--- a/webkit/plugins/ppapi/content_decryptor_delegate.cc
+++ b/webkit/plugins/ppapi/content_decryptor_delegate.cc
@@ -40,8 +40,7 @@ namespace {
// resource. The |*resource|, if valid, will be in the ResourceTracker with a
// reference-count of 0. If |data| is NULL, sets |*resource| to NULL. Returns
// true upon success and false if any error happened.
-bool MakeBufferResource(PP_Instance instance,
- const uint8* data, uint32_t size,
+bool MakeBufferResource(PP_Instance instance, const uint8* data, uint32_t size,
scoped_refptr<PPB_Buffer_Impl>* resource) {
TRACE_EVENT0("eme", "ContentDecryptorDelegate - MakeBufferResource");
DCHECK(resource);
@@ -54,12 +53,10 @@ bool MakeBufferResource(PP_Instance instance,
scoped_refptr<PPB_Buffer_Impl> buffer(
PPB_Buffer_Impl::CreateResource(instance, size));
- if (!buffer.get())
- return false;
+ if (!buffer.get()) return false;
BufferAutoMapper mapper(buffer.get());
- if (!mapper.data() || mapper.size() < size)
- return false;
+ if (!mapper.data() || mapper.size() < size) return false;
memcpy(mapper.data(), data, size);
*resource = buffer;
@@ -71,8 +68,7 @@ bool MakeBufferResource(PP_Instance instance,
// |array_size| is smaller than the |str| length.
template <uint32_t array_size>
bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
- if (array_size < str.size())
- return false;
+ if (array_size < str.size()) return false;
memcpy(array, str.data(), str.size());
return true;
@@ -84,16 +80,14 @@ bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
// otherwise.
static bool MakeEncryptedBlockInfo(
const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
- uint32_t request_id,
- PP_EncryptedBlockInfo* block_info) {
+ uint32_t request_id, PP_EncryptedBlockInfo* block_info) {
// TODO(xhwang): Fix initialization of PP_EncryptedBlockInfo here and
// anywhere else.
memset(block_info, 0, sizeof(*block_info));
block_info->tracking_info.request_id = request_id;
// EOS buffers need a request ID and nothing more.
- if (encrypted_buffer->IsEndOfStream())
- return true;
+ if (encrypted_buffer->IsEndOfStream()) return true;
DCHECK(encrypted_buffer->GetDataSize())
<< "DecryptConfig is set on an empty buffer";
@@ -129,13 +123,11 @@ static bool MakeEncryptedBlockInfo(
// Deserializes audio data stored in |audio_frames| into individual audio
// buffers in |frames|. Returns true upon success.
-bool DeserializeAudioFrames(PP_Resource audio_frames,
- int data_size,
+bool DeserializeAudioFrames(PP_Resource audio_frames, int data_size,
media::Decryptor::AudioBuffers* frames) {
DCHECK(frames);
EnterResourceNoLock<PPB_Buffer_API> enter(audio_frames, true);
- if (!enter.succeeded())
- return false;
+ if (!enter.succeeded()) return false;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
BufferAutoMapper mapper(enter.object());
if (!mapper.data() || !mapper.size() ||
@@ -150,8 +142,7 @@ bool DeserializeAudioFrames(PP_Resource audio_frames,
int64 frame_size = -1;
const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
- if (bytes_left < kHeaderSize)
- return false;
+ if (bytes_left < kHeaderSize) return false;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
memcpy(&timestamp, cur, sizeof(timestamp));
cur += sizeof(timestamp);
@@ -162,12 +153,11 @@ bool DeserializeAudioFrames(PP_Resource audio_frames,
bytes_left -= sizeof(frame_size);
// We should *not* have empty frame in the list.
- if (frame_size <= 0 || bytes_left < frame_size)
- return false;
+ if (frame_size <= 0 || bytes_left < frame_size) return false;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
scoped_refptr<media::DataBuffer> frame =
media::DataBuffer::CopyFrom(cur, frame_size);
- frame->SetTimestamp(base::TimeDelta::FromMicroseconds(timestamp));
+ frame->set_timestamp(base::TimeDelta::FromMicroseconds(timestamp));
frames->push_back(frame);
cur += frame_size;
@@ -282,8 +272,7 @@ ContentDecryptorDelegate::ContentDecryptorDelegate(
pending_audio_decode_request_id_(0),
pending_video_decode_request_id_(0),
weak_ptr_factory_(this),
- weak_this_(weak_ptr_factory_.GetWeakPtr()) {
-}
+ weak_this_(weak_ptr_factory_.GetWeakPtr()) {}
void ContentDecryptorDelegate::Initialize(const std::string& key_system) {
// TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private.
@@ -305,42 +294,34 @@ void ContentDecryptorDelegate::SetKeyEventCallbacks(
bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type,
const uint8* init_data,
int init_data_length) {
- PP_Var init_data_array =
- PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- init_data_length, init_data);
+ PP_Var init_data_array = PpapiGlobals::Get()->GetVarTracker()
+ ->MakeArrayBufferPPVar(init_data_length, init_data);
plugin_decryption_interface_->GenerateKeyRequest(
pp_instance_,
StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove.
- StringVar::StringToPPVar(type),
- init_data_array);
+ StringVar::StringToPPVar(type), init_data_array);
return true;
}
bool ContentDecryptorDelegate::AddKey(const std::string& session_id,
- const uint8* key,
- int key_length,
+ const uint8* key, int key_length,
const uint8* init_data,
int init_data_length) {
- PP_Var key_array =
- PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key_length,
- key);
- PP_Var init_data_array =
- PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- init_data_length, init_data);
+ PP_Var key_array = PpapiGlobals::Get()->GetVarTracker()
+ ->MakeArrayBufferPPVar(key_length, key);
+ PP_Var init_data_array = PpapiGlobals::Get()->GetVarTracker()
+ ->MakeArrayBufferPPVar(init_data_length, init_data);
plugin_decryption_interface_->AddKey(
- pp_instance_,
- StringVar::StringToPPVar(session_id),
- key_array,
+ pp_instance_, StringVar::StringToPPVar(session_id), key_array,
init_data_array);
return true;
}
bool ContentDecryptorDelegate::CancelKeyRequest(const std::string& session_id) {
plugin_decryption_interface_->CancelKeyRequest(
- pp_instance_,
- StringVar::StringToPPVar(session_id));
+ pp_instance_, StringVar::StringToPPVar(session_id));
return true;
}
@@ -355,8 +336,8 @@ bool ContentDecryptorDelegate::Decrypt(
// now because there is only one pending audio/video decrypt request at any
// time. This is enforced by the media pipeline.
scoped_refptr<PPB_Buffer_Impl> encrypted_resource;
- if (!MakeMediaBufferResource(
- stream_type, encrypted_buffer, &encrypted_resource) ||
+ if (!MakeMediaBufferResource(stream_type, encrypted_buffer,
+ &encrypted_resource) ||
!encrypted_resource.get()) {
return false;
}
@@ -393,9 +374,7 @@ bool ContentDecryptorDelegate::Decrypt(
SetBufferToFreeInTrackingInfo(&block_info.tracking_info);
- plugin_decryption_interface_->Decrypt(pp_instance_,
- pp_resource,
- &block_info);
+ plugin_decryption_interface_->Decrypt(pp_instance_, pp_resource, &block_info);
return true;
}
@@ -426,8 +405,7 @@ bool ContentDecryptorDelegate::CancelDecrypt(
return false;
}
- if (!decrypt_cb.is_null())
- decrypt_cb.Run(media::Decryptor::kSuccess, NULL);
+ if (!decrypt_cb.is_null()) decrypt_cb.Run(media::Decryptor::kSuccess, NULL);
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
return true;
}
@@ -445,8 +423,7 @@ bool ContentDecryptorDelegate::InitializeAudioDecoder(
pp_decoder_config.request_id = next_decryption_request_id_++;
scoped_refptr<PPB_Buffer_Impl> extra_data_resource;
- if (!MakeBufferResource(pp_instance_,
- decoder_config.extra_data(),
+ if (!MakeBufferResource(pp_instance_, decoder_config.extra_data(),
decoder_config.extra_data_size(),
&extra_data_resource)) {
return false;
@@ -458,9 +435,8 @@ bool ContentDecryptorDelegate::InitializeAudioDecoder(
pending_audio_decoder_init_request_id_ = pp_decoder_config.request_id;
pending_audio_decoder_init_cb_ = init_cb;
- plugin_decryption_interface_->InitializeAudioDecoder(pp_instance_,
- &pp_decoder_config,
- pp_resource);
+ plugin_decryption_interface_->InitializeAudioDecoder(
+ pp_instance_, &pp_decoder_config, pp_resource);
return true;
}
@@ -479,8 +455,7 @@ bool ContentDecryptorDelegate::InitializeVideoDecoder(
pp_decoder_config.request_id = next_decryption_request_id_++;
scoped_refptr<PPB_Buffer_Impl> extra_data_resource;
- if (!MakeBufferResource(pp_instance_,
- decoder_config.extra_data(),
+ if (!MakeBufferResource(pp_instance_, decoder_config.extra_data(),
decoder_config.extra_data_size(),
&extra_data_resource)) {
return false;
@@ -494,9 +469,8 @@ bool ContentDecryptorDelegate::InitializeVideoDecoder(
natural_size_ = decoder_config.natural_size();
- plugin_decryption_interface_->InitializeVideoDecoder(pp_instance_,
- &pp_decoder_config,
- pp_resource);
+ plugin_decryption_interface_->InitializeVideoDecoder(
+ pp_instance_, &pp_decoder_config, pp_resource);
return true;
}
@@ -530,8 +504,7 @@ bool ContentDecryptorDelegate::DecryptAndDecodeAudio(
// because there is only one pending audio decode request at any time.
// This is enforced by the media pipeline.
scoped_refptr<PPB_Buffer_Impl> encrypted_resource;
- if (!MakeMediaBufferResource(media::Decryptor::kAudio,
- encrypted_buffer,
+ if (!MakeMediaBufferResource(media::Decryptor::kAudio, encrypted_buffer,
&encrypted_resource)) {
return false;
}
@@ -560,10 +533,8 @@ bool ContentDecryptorDelegate::DecryptAndDecodeAudio(
pending_audio_decode_cb_ = audio_decode_cb;
ScopedPPResource pp_resource(encrypted_resource.get());
- plugin_decryption_interface_->DecryptAndDecode(pp_instance_,
- PP_DECRYPTORSTREAMTYPE_AUDIO,
- pp_resource,
- &block_info);
+ plugin_decryption_interface_->DecryptAndDecode(
+ pp_instance_, PP_DECRYPTORSTREAMTYPE_AUDIO, pp_resource, &block_info);
return true;
}
@@ -574,8 +545,7 @@ bool ContentDecryptorDelegate::DecryptAndDecodeVideo(
// because there is only one pending video decode request at any time.
// This is enforced by the media pipeline.
scoped_refptr<PPB_Buffer_Impl> encrypted_resource;
- if (!MakeMediaBufferResource(media::Decryptor::kVideo,
- encrypted_buffer,
+ if (!MakeMediaBufferResource(media::Decryptor::kVideo, encrypted_buffer,
&encrypted_resource)) {
return false;
}
@@ -607,10 +577,8 @@ bool ContentDecryptorDelegate::DecryptAndDecodeVideo(
// TODO(tomfinegan): Need to get stream type from media stack.
ScopedPPResource pp_resource(encrypted_resource.get());
- plugin_decryption_interface_->DecryptAndDecode(pp_instance_,
- PP_DECRYPTORSTREAMTYPE_VIDEO,
- pp_resource,
- &block_info);
+ plugin_decryption_interface_->DecryptAndDecode(
+ pp_instance_, PP_DECRYPTORSTREAMTYPE_VIDEO, pp_resource, &block_info);
return true;
}
@@ -623,8 +591,7 @@ void ContentDecryptorDelegate::NeedKey(PP_Var key_system_var,
void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var,
PP_Var session_id_var) {
- if (key_added_cb_.is_null())
- return;
+ if (key_added_cb_.is_null()) return;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
if (!session_id_string) {
@@ -639,13 +606,11 @@ void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var,
PP_Var session_id_var,
PP_Var message_var,
PP_Var default_url_var) {
- if (key_message_cb_.is_null())
- return;
+ if (key_message_cb_.is_null()) return;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
- ArrayBufferVar* message_array_buffer =
- ArrayBufferVar::FromPPVar(message_var);
+ ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message_var);
std::string message;
if (message_array_buffer) {
@@ -660,8 +625,7 @@ void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var,
return;
}
- key_message_cb_.Run(session_id_string->value(),
- message,
+ key_message_cb_.Run(session_id_string->value(), message,
default_url_string->value());
}
@@ -669,8 +633,7 @@ void ContentDecryptorDelegate::KeyError(PP_Var key_system_var,
PP_Var session_id_var,
int32_t media_error,
int32_t system_code) {
- if (key_error_cb_.is_null())
- return;
+ if (key_error_cb_.is_null()) return;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
StringVar* session_id_string = StringVar::FromPPVar(session_id_var);
if (!session_id_string) {
@@ -684,50 +647,42 @@ void ContentDecryptorDelegate::KeyError(PP_Var key_system_var,
}
void ContentDecryptorDelegate::DecoderInitializeDone(
- PP_DecryptorStreamType decoder_type,
- uint32_t request_id,
- PP_Bool success) {
+ PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) {
if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) {
// If the request ID is not valid or does not match what's saved, do
// nothing.
- if (request_id == 0 ||
- request_id != pending_audio_decoder_init_request_id_)
+ if (request_id == 0 || request_id != pending_audio_decoder_init_request_id_)
return;
- DCHECK(!pending_audio_decoder_init_cb_.is_null());
- pending_audio_decoder_init_request_id_ = 0;
- base::ResetAndReturn(
- &pending_audio_decoder_init_cb_).Run(PP_ToBool(success));
+ DCHECK(!pending_audio_decoder_init_cb_.is_null());
+ pending_audio_decoder_init_request_id_ = 0;
+ base::ResetAndReturn(&pending_audio_decoder_init_cb_)
+ .Run(PP_ToBool(success));
} else {
- if (request_id == 0 ||
- request_id != pending_video_decoder_init_request_id_)
+ if (request_id == 0 || request_id != pending_video_decoder_init_request_id_)
return;
- if (!success)
- natural_size_ = gfx::Size();
+ if (!success) natural_size_ = gfx::Size();
- DCHECK(!pending_video_decoder_init_cb_.is_null());
- pending_video_decoder_init_request_id_ = 0;
- base::ResetAndReturn(
- &pending_video_decoder_init_cb_).Run(PP_ToBool(success));
+ DCHECK(!pending_video_decoder_init_cb_.is_null());
+ pending_video_decoder_init_request_id_ = 0;
+ base::ResetAndReturn(&pending_video_decoder_init_cb_)
+ .Run(PP_ToBool(success));
}
}
void ContentDecryptorDelegate::DecoderDeinitializeDone(
- PP_DecryptorStreamType decoder_type,
- uint32_t request_id) {
+ PP_DecryptorStreamType decoder_type, uint32_t request_id) {
// TODO(tomfinegan): Add decoder stop completion handling.
}
void ContentDecryptorDelegate::DecoderResetDone(
- PP_DecryptorStreamType decoder_type,
- uint32_t request_id) {
+ PP_DecryptorStreamType decoder_type, uint32_t request_id) {
// TODO(tomfinegan): Add decoder reset completion handling.
}
void ContentDecryptorDelegate::DeliverBlock(
- PP_Resource decrypted_block,
- const PP_DecryptedBlockInfo* block_info) {
+ PP_Resource decrypted_block, const PP_DecryptedBlockInfo* block_info) {
DCHECK(block_info);
FreeBuffer(block_info->tracking_info.buffer_id);
@@ -777,10 +732,10 @@ void ContentDecryptorDelegate::DeliverBlock(
// TODO(tomfinegan): Find a way to take ownership of the shared memory
// managed by the PPB_Buffer_Dev, and avoid the extra copy.
scoped_refptr<media::DecoderBuffer> decrypted_buffer(
- media::DecoderBuffer::CopyFrom(
- static_cast<uint8*>(mapper.data()), block_info->data_size));
- decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds(
- block_info->tracking_info.timestamp));
+ media::DecoderBuffer::CopyFrom(static_cast<uint8*>(mapper.data()),
+ block_info->data_size));
+ decrypted_buffer->SetTimestamp(
+ base::TimeDelta::FromMicroseconds(block_info->tracking_info.timestamp));
decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer);
}
@@ -799,12 +754,10 @@ static void BufferNoLongerNeeded(
static uint8* GetMappedBuffer(PP_Resource resource,
scoped_refptr<PPB_Buffer_Impl>* ppb_buffer) {
EnterResourceNoLock<PPB_Buffer_API> enter(resource, true);
- if (!enter.succeeded())
- return NULL;
+ if (!enter.succeeded()) return NULL;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
uint8* mapped_data = static_cast<uint8*>(enter.object()->Map());
- if (!enter.object()->IsMapped() || !mapped_data)
- return NULL;
+ if (!enter.object()->IsMapped() || !mapped_data) return NULL;
uint32_t mapped_size = 0;
if (!enter.object()->Describe(&mapped_size) || !mapped_size) {
@@ -818,8 +771,7 @@ static uint8* GetMappedBuffer(PP_Resource resource,
}
void ContentDecryptorDelegate::DeliverFrame(
- PP_Resource decrypted_frame,
- const PP_DecryptedFrameInfo* frame_info) {
+ PP_Resource decrypted_frame, const PP_DecryptedFrameInfo* frame_info) {
DCHECK(frame_info);
const uint32_t request_id = frame_info->tracking_info.request_id;
@@ -861,9 +813,8 @@ void ContentDecryptorDelegate::DeliverFrame(
scoped_refptr<media::VideoFrame> decoded_frame =
media::VideoFrame::WrapExternalYuvData(
- media::VideoFrame::YV12,
- frame_size, gfx::Rect(frame_size), natural_size_,
- frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y],
+ media::VideoFrame::YV12, frame_size, gfx::Rect(frame_size),
+ natural_size_, frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y],
frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U],
frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V],
frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y],
@@ -873,17 +824,16 @@ void ContentDecryptorDelegate::DeliverFrame(
frame_info->tracking_info.timestamp),
media::BindToLoop(
base::MessageLoopProxy::current(),
- base::Bind(&BufferNoLongerNeeded, ppb_buffer,
- base::Bind(&ContentDecryptorDelegate::FreeBuffer,
- weak_this_,
- frame_info->tracking_info.buffer_id))));
+ base::Bind(
+ &BufferNoLongerNeeded, ppb_buffer,
+ base::Bind(&ContentDecryptorDelegate::FreeBuffer, weak_this_,
+ frame_info->tracking_info.buffer_id))));
video_decode_cb.Run(media::Decryptor::kSuccess, decoded_frame);
}
void ContentDecryptorDelegate::DeliverSamples(
- PP_Resource audio_frames,
- const PP_DecryptedBlockInfo* block_info) {
+ PP_Resource audio_frames, const PP_DecryptedBlockInfo* block_info) {
DCHECK(block_info);
FreeBuffer(block_info->tracking_info.buffer_id);
@@ -912,8 +862,7 @@ void ContentDecryptorDelegate::DeliverSamples(
}
media::Decryptor::AudioBuffers audio_frame_list;
- if (!DeserializeAudioFrames(audio_frames,
- block_info->data_size,
+ if (!DeserializeAudioFrames(audio_frames, block_info->data_size,
&audio_frame_list)) {
NOTREACHED() << "CDM did not serialize the buffer correctly.";
audio_decode_cb.Run(media::Decryptor::kError, empty_frames);
@@ -934,8 +883,8 @@ void ContentDecryptorDelegate::CancelDecode(
audio_input_resource_ = NULL;
pending_audio_decode_request_id_ = 0;
if (!pending_audio_decode_cb_.is_null())
- base::ResetAndReturn(&pending_audio_decode_cb_).Run(
- media::Decryptor::kSuccess, media::Decryptor::AudioBuffers());
+ base::ResetAndReturn(&pending_audio_decode_cb_)
+ .Run(media::Decryptor::kSuccess, media::Decryptor::AudioBuffers());
break;
case media::Decryptor::kVideo:
// Release the shared memory as it can still be in use by the plugin.
@@ -944,8 +893,8 @@ void ContentDecryptorDelegate::CancelDecode(
video_input_resource_ = NULL;
pending_video_decode_request_id_ = 0;
if (!pending_video_decode_cb_.is_null())
- base::ResetAndReturn(&pending_video_decode_cb_).Run(
- media::Decryptor::kSuccess, NULL);
+ base::ResetAndReturn(&pending_video_decode_cb_)
+ .Run(media::Decryptor::kSuccess, NULL);
break;
default:
NOTREACHED();
@@ -967,8 +916,8 @@ bool ContentDecryptorDelegate::MakeMediaBufferResource(
DCHECK(stream_type == media::Decryptor::kAudio ||
stream_type == media::Decryptor::kVideo);
scoped_refptr<PPB_Buffer_Impl>& media_resource =
- (stream_type == media::Decryptor::kAudio) ? audio_input_resource_ :
- video_input_resource_;
+ (stream_type == media::Decryptor::kAudio) ? audio_input_resource_
+ : video_input_resource_;
const size_t data_size = static_cast<size_t>(encrypted_buffer->GetDataSize());
if (!media_resource.get() || media_resource->size() < data_size) {
@@ -983,17 +932,15 @@ bool ContentDecryptorDelegate::MakeMediaBufferResource(
const uint32_t kMinimumMediaBufferSize = 1024;
uint32_t media_resource_size =
media_resource.get() ? media_resource->size() : kMinimumMediaBufferSize;
- while (media_resource_size < data_size)
- media_resource_size *= 2;
+ while (media_resource_size < data_size) media_resource_size *= 2;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line whil
DVLOG(2) << "Size of media buffer for "
<< ((stream_type == media::Decryptor::kAudio) ? "audio" : "video")
<< " stream bumped to " << media_resource_size
<< " bytes to fit input.";
- media_resource = PPB_Buffer_Impl::CreateResource(pp_instance_,
- media_resource_size);
- if (!media_resource.get())
- return false;
+ media_resource =
+ PPB_Buffer_Impl::CreateResource(pp_instance_, media_resource_size);
+ if (!media_resource.get()) return false;
}
BufferAutoMapper mapper(media_resource.get());
@@ -1008,16 +955,14 @@ bool ContentDecryptorDelegate::MakeMediaBufferResource(
}
void ContentDecryptorDelegate::FreeBuffer(uint32_t buffer_id) {
- if (buffer_id)
- free_buffers_.push(buffer_id);
+ if (buffer_id) free_buffers_.push(buffer_id);
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
}
void ContentDecryptorDelegate::SetBufferToFreeInTrackingInfo(
PP_DecryptTrackingInfo* tracking_info) {
DCHECK_EQ(tracking_info->buffer_id, 0u);
- if (free_buffers_.empty())
- return;
+ if (free_buffers_.empty()) return;
scherkus (not reviewing) 2013/06/21 19:48:38 revert this change -- we don't do single-line ifs
tracking_info->buffer_id = free_buffers_.front();
free_buffers_.pop();

Powered by Google App Engine
This is Rietveld 408576698