[vlc-commits] opus: remove dead code

Tristan Matthews git at videolan.org
Mon Jan 12 23:17:59 CET 2015


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Mon Jan 12 13:01:24 2015 -0500| [763a902e85bc5e75b1bd2e598a8c8a2e84e472a5] | committer: Tristan Matthews

opus: remove dead code

opus_prepare_header is "too small to fail"

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=763a902e85bc5e75b1bd2e598a8c8a2e84e472a5
---

 modules/codec/opus.c        |   10 ++--------
 modules/codec/opus_header.c |    4 +---
 modules/codec/opus_header.h |    2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index 1eb885e..1e93cd4 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -611,14 +611,8 @@ static int OpenEncoder(vlc_object_t *p_this)
 
     OpusHeader header;
 
-    if (opus_prepare_header(enc->fmt_out.audio.i_channels,
-            enc->fmt_out.audio.i_rate,
-            &header))
-    {
-        msg_Err(enc, "Failed to prepare header.");
-        status = VLC_ENOMEM;
-        goto error;
-    }
+    opus_prepare_header(enc->fmt_out.audio.i_channels,
+            enc->fmt_out.audio.i_rate, &header);
 
     /* needed for max encoded size calculation */
     sys->nb_streams = header.nb_streams;
diff --git a/modules/codec/opus_header.c b/modules/codec/opus_header.c
index 101a33d..392b673 100644
--- a/modules/codec/opus_header.c
+++ b/modules/codec/opus_header.c
@@ -299,7 +299,7 @@ static int comment_pad(char **comments, size_t *length)
     return 0;
 }
 
-int opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header)
+void opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header)
 {
     header->version = 1;
     header->channels = channels;
@@ -309,8 +309,6 @@ int opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header)
     header->gain = 0; // 0dB
     header->channel_mapping = header->channels > 8 ? 255 :
                               header->channels > 2;
-
-    return 0;
 }
 
 static int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len)
diff --git a/modules/codec/opus_header.h b/modules/codec/opus_header.h
index a4c1f16..4b6a4e5 100644
--- a/modules/codec/opus_header.h
+++ b/modules/codec/opus_header.h
@@ -44,7 +44,7 @@ typedef struct {
 } OpusHeader;
 
 int opus_header_parse(const unsigned char *header, int len, OpusHeader *h);
-int opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header);
+void opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header);
 int opus_write_header(uint8_t **p_extra, int *i_extra, OpusHeader *header, const char *vendor);
 
 #endif



More information about the vlc-commits mailing list