Re: ReadOnlyFileException when reading mp3

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

Parent Message unknown Re: ReadOnlyFileException when reading mp3

by Alayn Gortazar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep.

It has permissions to read, but not to write. We don't want Red5 to be able to modify the mp3 files (just in case...).
I took a look at AudioFileIO's doc, and I saw that the read() method always throws a ReadOnlyFileException when the file is in read only mode.
http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/audio/AudioFileIO.html

--
Alayn Gortazar

----- Mensaje original -----
De: "Hugo Flambó" <hflambo@...>
Para: red5@...
Enviados: Jueves, 5 de Noviembre 2009 11:19:51
Asunto: Re: [Red5] ReadOnlyFileException when reading mp3

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

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

Re: ReadOnlyFileException when reading mp3

by Walter Tak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You know Red5 should be able to write to the directory to create the
meta-file there per mp3 ?

Walter

----- Original Message -----
From: "Alayn Gortazar" <alayn@...>
To: <red5@...>
Sent: Thursday, 05 November 2009 11:45
Subject: Re: [Red5] ReadOnlyFileException when reading mp3


> Yep.
>
> It has permissions to read, but not to write. We don't want Red5 to be
> able to modify the mp3 files (just in case...).
> I took a look at AudioFileIO's doc, and I saw that the read() method
> always throws a ReadOnlyFileException when the file is in read only mode.
> http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/audio/AudioFileIO.html
>
> --
> Alayn Gortazar
>
> ----- Mensaje original -----
> De: "Hugo Flambó" <hflambo@...>
> Para: red5@...
> Enviados: Jueves, 5 de Noviembre 2009 11:19:51
> Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
>
> 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
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>


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

Parent Message unknown Re: ReadOnlyFileException when reading mp3

by Alayn Gortazar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep,
Red5 indeed has write permissions on the folder.

But it has no need to write the mp3 file, right?? I know that this may not have too much sense as it would be able to remove the mp3 files, but if we can avoid an unnecessary error message...

--
Alayn Gortazar

----- Mensaje original -----
De: "Walter Tak" <walter@...>
Para: red5@...
Enviados: Jueves, 5 de Noviembre 2009 16:38:29
Asunto: Re: [Red5] ReadOnlyFileException when reading mp3

You know Red5 should be able to write to the directory to create the
meta-file there per mp3 ?

Walter

----- Original Message -----
From: "Alayn Gortazar" <alayn@...>
To: <red5@...>
Sent: Thursday, 05 November 2009 11:45
Subject: Re: [Red5] ReadOnlyFileException when reading mp3


> Yep.
>
> It has permissions to read, but not to write. We don't want Red5 to be
> able to modify the mp3 files (just in case...).
> I took a look at AudioFileIO's doc, and I saw that the read() method
> always throws a ReadOnlyFileException when the file is in read only mode.
> http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/audio/AudioFileIO.html
>
> --
> Alayn Gortazar
>
> ----- Mensaje original -----
> De: "Hugo Flambó" <hflambo@...>
> Para: red5@...
> Enviados: Jueves, 5 de Noviembre 2009 11:19:51
> Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
>
> 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
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>


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

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

Re: ReadOnlyFileException when reading mp3

by Walter Tak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No your comment is correct and right, Red5 does not need write access to mp3
files at all, unless you want to append data to it (possible from
client-side using the "append" parameter in
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/NetStream.html#publish%28%29

Are you sure your patch does not break that feature ?

W.

----- Original Message -----
From: "Alayn Gortazar" <alayn@...>
To: <red5@...>
Sent: Thursday, 05 November 2009 16:58
Subject: Re: [Red5] ReadOnlyFileException when reading mp3


> Yep,
> Red5 indeed has write permissions on the folder.
>
> But it has no need to write the mp3 file, right?? I know that this may not
> have too much sense as it would be able to remove the mp3 files, but if we
> can avoid an unnecessary error message...
>
> --
> Alayn Gortazar
>
> ----- Mensaje original -----
> De: "Walter Tak" <walter@...>
> Para: red5@...
> Enviados: Jueves, 5 de Noviembre 2009 16:38:29
> Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
>
> You know Red5 should be able to write to the directory to create the
> meta-file there per mp3 ?
>
> Walter
>
> ----- Original Message -----
> From: "Alayn Gortazar" <alayn@...>
> To: <red5@...>
> Sent: Thursday, 05 November 2009 11:45
> Subject: Re: [Red5] ReadOnlyFileException when reading mp3
>
>
>> Yep.
>>
>> It has permissions to read, but not to write. We don't want Red5 to be
>> able to modify the mp3 files (just in case...).
>> I took a look at AudioFileIO's doc, and I saw that the read() method
>> always throws a ReadOnlyFileException when the file is in read only mode.
>> http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/audio/AudioFileIO.html
>>
>> --
>> Alayn Gortazar
>>
>> ----- Mensaje original -----
>> De: "Hugo Flambó" <hflambo@...>
>> Para: red5@...
>> Enviados: Jueves, 5 de Noviembre 2009 11:19:51
>> Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
>>
>> 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
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5@...
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>


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

Parent Message unknown Re: ReadOnlyFileException when reading mp3

by Alayn Gortazar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I didn't really test, but I'm pretty sure it doesn't.

As far as I see the mp3file var is only used to read the ID3 data and then is set to null at line 219.
=======================================
219: mp3file = null;
=======================================

--
Alayn Gortazar

----- "Walter Tak" <walter@...> escribió:

> No your comment is correct and right, Red5 does not need write access
> to mp3
> files at all, unless you want to append data to it (possible from
> client-side using the "append" parameter in
> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/NetStream.html#publish%28%29
>
> Are you sure your patch does not break that feature ?
>
> W.
>
> ----- Original Message -----
> From: "Alayn Gortazar" <alayn@...>
> To: <red5@...>
> Sent: Thursday, 05 November 2009 16:58
> Subject: Re: [Red5] ReadOnlyFileException when reading mp3
>
>
> > Yep,
> > Red5 indeed has write permissions on the folder.
> >
> > But it has no need to write the mp3 file, right?? I know that this
> may not
> > have too much sense as it would be able to remove the mp3 files, but
> if we
> > can avoid an unnecessary error message...
> >
> > --
> > Alayn Gortazar
> >
> > ----- Mensaje original -----
> > De: "Walter Tak" <walter@...>
> > Para: red5@...
> > Enviados: Jueves, 5 de Noviembre 2009 16:38:29
> > Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
> >
> > You know Red5 should be able to write to the directory to create the
> > meta-file there per mp3 ?
> >
> > Walter
> >
> > ----- Original Message -----
> > From: "Alayn Gortazar" <alayn@...>
> > To: <red5@...>
> > Sent: Thursday, 05 November 2009 11:45
> > Subject: Re: [Red5] ReadOnlyFileException when reading mp3
> >
> >
> >> Yep.
> >>
> >> It has permissions to read, but not to write. We don't want Red5 to
> be
> >> able to modify the mp3 files (just in case...).
> >> I took a look at AudioFileIO's doc, and I saw that the read()
> method
> >> always throws a ReadOnlyFileException when the file is in read only
> mode.
> >>
> http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/audio/AudioFileIO.html
> >>
> >> --
> >> Alayn Gortazar
> >>
> >> ----- Mensaje original -----
> >> De: "Hugo Flambó" <hflambo@...>
> >> Para: red5@...
> >> Enviados: Jueves, 5 de Noviembre 2009 11:19:51
> >> Asunto: Re: [Red5] ReadOnlyFileException when reading mp3
> >>
> >> 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
> >>
> >> _______________________________________________
> >> Red5 mailing list
> >> Red5@...
> >> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>
> >
> >
> > _______________________________________________
> > Red5 mailing list
> > Red5@...
> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >
> > _______________________________________________
> > Red5 mailing list
> > Red5@...
> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >
>
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org

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