Skip to content

Commit

Permalink
Remove media's dependency on net
Browse files Browse the repository at this point in the history
This dependency was added to do a very simple string operation. Now that media
does not depend on net/ via ui/gfx any more, it doesn't make sense to have this
dependency just for this one function.

R=acolwell

Review URL: https://codereview.chromium.org/141863004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246290 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jamesr@chromium.org committed Jan 22, 2014
1 parent f61eb84 commit 7550f51
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 0 additions & 1 deletion media/DEPS
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include_rules = [
"+gpu",
"+jni",
"+net/http",
"+third_party/ffmpeg",
"+third_party/libvpx",
"+third_party/opus",
Expand Down
1 change: 0 additions & 1 deletion media/media.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../crypto/crypto.gyp:crypto',
'../net/net.gyp:net',
'../gpu/gpu.gyp:command_buffer_common',
'../skia/skia.gyp:skia',
'../third_party/opus/opus.gyp:opus',
Expand Down
22 changes: 19 additions & 3 deletions media/mp3/mp3_stream_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "media/base/stream_parser_buffer.h"
#include "media/base/text_track_config.h"
#include "media/base/video_decoder_config.h"
#include "net/http/http_util.h"

namespace media {

Expand Down Expand Up @@ -430,6 +429,24 @@ int MP3StreamParser::ParseMP3Frame(const uint8* data,
return frame_size;
}

static int LocateEndOfHeaders(const uint8_t* buf, int buf_len, int i) {
bool was_lf = false;
char last_c = '\0';
for (; i < buf_len; ++i) {
char c = buf[i];
if (c == '\n') {
if (was_lf)
return i + 1;
was_lf = true;
} else if (c != '\r' || last_c != '\n') {
was_lf = false;
}
last_c = c;
}
return -1;
}


int MP3StreamParser::ParseIcecastHeader(const uint8* data, int size) {
DVLOG(1) << __FUNCTION__ << "(" << size << ")";

Expand All @@ -440,8 +457,7 @@ int MP3StreamParser::ParseIcecastHeader(const uint8* data, int size) {
return -1;

int locate_size = std::min(size, kMaxIcecastHeaderSize);
int offset = net::HttpUtil::LocateEndOfHeaders(
reinterpret_cast<const char*>(data), locate_size, 4);
int offset = LocateEndOfHeaders(data, locate_size, 4);
if (offset < 0) {
if (locate_size == kMaxIcecastHeaderSize) {
MEDIA_LOG(log_cb_) << "Icecast header is too large.";
Expand Down

0 comments on commit 7550f51

Please sign in to comment.