diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-14 22:56:44 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-14 22:56:44 +0000 |
commit | 2e18afae8641e2e7617d901128fd9be1a65c5290 (patch) | |
tree | 1e6517b091c3460628da3f5a26de30abaa3553e6 | |
parent | 7d0e0d2fe58f1ec5e063f6acca5941d7e6e1ad14 (diff) | |
download | chromium_src-2e18afae8641e2e7617d901128fd9be1a65c5290.zip chromium_src-2e18afae8641e2e7617d901128fd9be1a65c5290.tar.gz chromium_src-2e18afae8641e2e7617d901128fd9be1a65c5290.tar.bz2 |
Revert 176748
> Introduce IPC validation to the media::VideoCaptureParams type.
>
> BUG=167199
> Review URL: https://codereview.chromium.org/11642053
TBR=cevans@chromium.org
Review URL: https://codereview.chromium.org/11884038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176750 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/common/media/audio_messages.h | 2 | ||||
-rw-r--r-- | content/common/media/audio_param_traits.cc (renamed from content/common/media/media_param_traits.cc) | 44 | ||||
-rw-r--r-- | content/common/media/audio_param_traits.h (renamed from content/common/media/media_param_traits.h) | 15 | ||||
-rw-r--r-- | content/common/media/video_capture_messages.h | 7 | ||||
-rw-r--r-- | content/content_common.gypi | 4 | ||||
-rw-r--r-- | media/base/limits.h | 3 |
6 files changed, 14 insertions, 61 deletions
diff --git a/content/common/media/audio_messages.h b/content/common/media/audio_messages.h index cac43d1..e78cfdd 100644 --- a/content/common/media/audio_messages.h +++ b/content/common/media/audio_messages.h @@ -11,7 +11,7 @@ #include "base/shared_memory.h" #include "base/sync_socket.h" #include "content/common/content_export.h" -#include "content/common/media/media_param_traits.h" +#include "content/common/media/audio_param_traits.h" #include "ipc/ipc_message_macros.h" #include "media/audio/audio_buffers_state.h" #include "media/audio/audio_input_ipc.h" diff --git a/content/common/media/media_param_traits.cc b/content/common/media/audio_param_traits.cc index 85ef57c..215bd71 100644 --- a/content/common/media/media_param_traits.cc +++ b/content/common/media/audio_param_traits.cc @@ -2,17 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/media/media_param_traits.h" +#include "content/common/media/audio_param_traits.h" #include "base/stringprintf.h" #include "media/audio/audio_parameters.h" -#include "media/base/limits.h" -#include "media/video/capture/video_capture_types.h" using media::AudioParameters; using media::ChannelLayout; -using media::VideoCaptureParams; -using media::VideoCaptureSessionId; namespace IPC { @@ -52,42 +48,4 @@ void ParamTraits<AudioParameters>::Log(const AudioParameters& p, l->append(base::StringPrintf("<AudioParameters>")); } -void ParamTraits<VideoCaptureParams>::Write(Message* m, - const VideoCaptureParams& p) { - m->WriteInt(p.width); - m->WriteInt(p.height); - m->WriteInt(p.frame_per_second); - m->WriteInt(static_cast<int>(p.session_id)); -} - -bool ParamTraits<VideoCaptureParams>::Read(const Message* m, - PickleIterator* iter, - VideoCaptureParams* r) { - int session_id; - - if (!m->ReadInt(iter, &r->width) || - !m->ReadInt(iter, &r->height) || - !m->ReadInt(iter, &r->frame_per_second) || - !m->ReadInt(iter, &session_id)) - return false; - - r->session_id = static_cast<VideoCaptureSessionId>(session_id); - - // TODO(wjia): Replace with IsValid() method on VideoCaptureParams. - if (r->width <= 0 || r->height <= 0 || r->frame_per_second <= 0 || - r->frame_per_second > media::limits::kMaxFramesPerSecond || - r->width > media::limits::kMaxDimension || - r->height > media::limits::kMaxDimension || - r->width * r->height > media::limits::kMaxCanvas) { - return false; - } - - return true; -} - -void ParamTraits<VideoCaptureParams>::Log(const VideoCaptureParams& p, - std::string* l) { - l->append(base::StringPrintf("<VideoCaptureParams>")); -} - } diff --git a/content/common/media/media_param_traits.h b/content/common/media/audio_param_traits.h index 55dcf0e..6910906 100644 --- a/content/common/media/media_param_traits.h +++ b/content/common/media/audio_param_traits.h @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_COMMON_MEDIA_MEDIA_PARAM_TRAITS_H_ -#define CONTENT_COMMON_MEDIA_MEDIA_PARAM_TRAITS_H_ +#ifndef CONTENT_COMMON_MEDIA_AUDIO_AUDIO_PARAM_TRAITS_H_ +#define CONTENT_COMMON_MEDIA_AUDIO_AUDIO_PARAM_TRAITS_H_ #include "ipc/ipc_message.h" #include "ipc/ipc_param_traits.h" namespace media { class AudioParameters; -class VideoCaptureParams; } namespace IPC { @@ -23,14 +22,6 @@ struct ParamTraits<media::AudioParameters> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<media::VideoCaptureParams> { - typedef media::VideoCaptureParams param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, PickleIterator* iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - } // namespace IPC -#endif // CONTENT_COMMON_MEDIA_MEDIA_PARAM_TRAITS_H_ +#endif // CONTENT_COMMON_MEDIA_AUDIO_AUDIO_PARAM_TRAITS_H_ diff --git a/content/common/media/video_capture_messages.h b/content/common/media/video_capture_messages.h index 9ea9a43..7e167e2 100644 --- a/content/common/media/video_capture_messages.h +++ b/content/common/media/video_capture_messages.h @@ -15,6 +15,13 @@ IPC_ENUM_TRAITS(content::VideoCaptureState) +IPC_STRUCT_TRAITS_BEGIN(media::VideoCaptureParams) + IPC_STRUCT_TRAITS_MEMBER(width) + IPC_STRUCT_TRAITS_MEMBER(height) + IPC_STRUCT_TRAITS_MEMBER(frame_per_second) + IPC_STRUCT_TRAITS_MEMBER(session_id) +IPC_STRUCT_TRAITS_END() + // Notify the renderer process about the state update such as // Start/Pause/Stop. IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged, diff --git a/content/content_common.gypi b/content/content_common.gypi index 52c6452..8516920 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -292,8 +292,8 @@ 'common/mac/font_loader.h', 'common/mac/font_loader.mm', 'common/media/audio_messages.h', - 'common/media/media_param_traits.cc', - 'common/media/media_param_traits.h', + 'common/media/audio_param_traits.cc', + 'common/media/audio_param_traits.h', 'common/media/media_player_messages.h', 'common/media/media_stream_messages.h', 'common/media/media_stream_options.cc', diff --git a/media/base/limits.h b/media/base/limits.h index 309635f..66ceaf2 100644 --- a/media/base/limits.h +++ b/media/base/limits.h @@ -38,9 +38,6 @@ enum { kMaxSamplesPerPacket = kMaxSampleRate, kMaxPacketSizeInBytes = (kMaxBitsPerSample / 8) * kMaxChannels * kMaxSamplesPerPacket, - - // This limit is used by ParamTraits<VideoCaptureParams>. - kMaxFramesPerSecond = 1000, }; } // namespace limits |