ReadOnlyFileException when reading mp3

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown ReadOnlyFileException when reading mp3

by Alayn Gortazar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there again,

We are streaming some mp3's from Red5 and it doesn't stop throwing error messages saying because it can't write the mp3 files... (we don't want red5 to be able to do this neither)

I took a look at the code and it uses "AudioFileIO.read(file)" to get the file, which always throws a ReadOnlyFileException when it opens a readonly file.

I may be wrong, but I think this exception should be catched or avoided, cause as far as I know Red5 does not need to modify the MP3 file.

I see 2 solutions:
 * Catch the ReadOnlyFileException
 * Modify the way Red5 gets the file.

I made this change to the code and the error desappeared:

Index: src/org/red5/io/mp3/impl/MP3Reader.java
===================================================================
--- src/org/red5/io/mp3/impl/MP3Reader.java (revisión: 3932)
+++ src/org/red5/io/mp3/impl/MP3Reader.java (working copy)
@@ -152,7 +152,7 @@
 
  // parse the id3 info
  try {
- MP3File mp3file = (MP3File) AudioFileIO.read(file);
+ MP3File mp3file = new MP3File(file, MP3File.LOAD_ALL,true);
  MP3AudioHeader audioHeader = (MP3AudioHeader) mp3file.getAudioHeader();
  if (audioHeader != null) {
  log.debug("Track length: {}", audioHeader.getTrackLength());

--
Alayn Gortazar
Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
+34 94.404.81.82

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: ReadOnlyFileException when reading mp3

by Hugo Flambó :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The red5 server process running with that user have permissions to
read? Did the files belong to that user/usergroup?

BR

Hugo

On Thu, Nov 5, 2009 at 10:02 AM, Alayn Gortazar <alayn@...> wrote:

> Hi there again,
>
> We are streaming some mp3's from Red5 and it doesn't stop throwing error messages saying because it can't write the mp3 files... (we don't want red5 to be able to do this neither)
>
> I took a look at the code and it uses "AudioFileIO.read(file)" to get the file, which always throws a ReadOnlyFileException when it opens a readonly file.
>
> I may be wrong, but I think this exception should be catched or avoided, cause as far as I know Red5 does not need to modify the MP3 file.
>
> I see 2 solutions:
>  * Catch the ReadOnlyFileException
>  * Modify the way Red5 gets the file.
>
> I made this change to the code and the error desappeared:
>
> Index: src/org/red5/io/mp3/impl/MP3Reader.java
> ===================================================================
> --- src/org/red5/io/mp3/impl/MP3Reader.java     (revisión: 3932)
> +++ src/org/red5/io/mp3/impl/MP3Reader.java     (working copy)
> @@ -152,7 +152,7 @@
>
>                // parse the id3 info
>                try {
> -                       MP3File mp3file = (MP3File) AudioFileIO.read(file);
> +                       MP3File mp3file = new MP3File(file, MP3File.LOAD_ALL,true);
>                        MP3AudioHeader audioHeader = (MP3AudioHeader) mp3file.getAudioHeader();
>                        if (audioHeader != null) {
>                                log.debug("Track length: {}", audioHeader.getTrackLength());
>
> --
> Alayn Gortazar
> Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
> +34 94.404.81.82
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org